Convert DOS-style line endings to Unix-style.
authorDavid Griffith <dave@661.org>
Tue, 27 Mar 2018 17:46:02 +0000 (10:46 -0700)
committerDavid Griffith <dave@661.org>
Tue, 27 Mar 2018 17:46:02 +0000 (10:46 -0700)
src/sdl/samplerate.h
src/sdl/sf_deffont.c
src/sdl/sf_osfdlg.c
src/sdl/sf_video.c

index a446fff8d23403321b12dacc920a8acebff7aae0..9232dc29da2767987d794dacdc3e610afb5b3036 100644 (file)
-/*\r
-** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>\r
-**\r
-** This program is free software; you can redistribute it and/or modify\r
-** it under the terms of the GNU General Public License as published by\r
-** the Free Software Foundation; either version 2 of the License, or\r
-** (at your option) any later version.\r
-**\r
-** This program is distributed in the hope that it will be useful,\r
-** but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-** GNU General Public License for more details.\r
-**\r
-** You should have received a copy of the GNU General Public License\r
-** along with this program; if not, write to the Free Software\r
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\r
-*/\r
-\r
-/*\r
-** API documentation is available here:\r
-**     http://www.mega-nerd.com/SRC/api.html\r
-*/\r
-\r
-#ifndef SAMPLERATE_H\r
-#define SAMPLERATE_H\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif /* __cplusplus */\r
-\r
-\r
-/* Opaque data type SRC_STATE. */\r
-typedef struct SRC_STATE_tag SRC_STATE ;\r
-\r
-/* SRC_DATA is used to pass data to src_simple() and src_process(). */\r
-typedef struct\r
-{      float   *data_in, *data_out ;\r
-\r
-       long    input_frames, output_frames ;\r
-       long    input_frames_used, output_frames_gen ;\r
-\r
-       int             end_of_input ;\r
-\r
-       double  src_ratio ;\r
-} SRC_DATA ;\r
-\r
-/* SRC_CB_DATA is used with callback based API. */\r
-typedef struct\r
-{      long    frames ;\r
-       float   *data_in ;\r
-} SRC_CB_DATA ;\r
-\r
-/*\r
-** User supplied callback function type for use with src_callback_new()\r
-** and src_callback_read(). First parameter is the same pointer that was\r
-** passed into src_callback_new(). Second parameter is pointer to a\r
-** pointer. The user supplied callback function must modify *data to\r
-** point to the start of the user supplied float array. The user supplied\r
-** function must return the number of frames that **data points to.\r
-*/\r
-\r
-typedef long (*src_callback_t) (void *cb_data, float **data) ;\r
-\r
-/*\r
-**     Standard initialisation function : return an anonymous pointer to the\r
-**     internal state of the converter. Choose a converter from the enums below.\r
-**     Error returned in *error.\r
-*/\r
-\r
-SRC_STATE* src_new (int converter_type, int channels, int *error) ;\r
-\r
-/*\r
-**     Initilisation for callback based API : return an anonymous pointer to the\r
-**     internal state of the converter. Choose a converter from the enums below.\r
-**     The cb_data pointer can point to any data or be set to NULL. Whatever the\r
-**     value, when processing, user supplied function "func" gets called with\r
-**     cb_data as first parameter.\r
-*/\r
-\r
-SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels,\r
-                               int *error, void* cb_data) ;\r
-\r
-/*\r
-**     Cleanup all internal allocations.\r
-**     Always returns NULL.\r
-*/\r
-\r
-SRC_STATE* src_delete (SRC_STATE *state) ;\r
-\r
-/*\r
-**     Standard processing function.\r
-**     Returns non zero on error.\r
-*/\r
-\r
-int src_process (SRC_STATE *state, SRC_DATA *data) ;\r
-\r
-/*\r
-**     Callback based processing function. Read up to frames worth of data from\r
-**     the converter int *data and return frames read or -1 on error.\r
-*/\r
-long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) ;\r
-\r
-/*\r
-**     Simple interface for performing a single conversion from input buffer to\r
-**     output buffer at a fixed conversion ratio.\r
-**     Simple interface does not require initialisation as it can only operate on\r
-**     a single buffer worth of audio.\r
-*/\r
-\r
-int src_simple (SRC_DATA *data, int converter_type, int channels) ;\r
-\r
-/*\r
-** This library contains a number of different sample rate converters,\r
-** numbered 0 through N.\r
-**\r
-** Return a string giving either a name or a more full description of each\r
-** sample rate converter or NULL if no sample rate converter exists for\r
-** the given value. The converters are sequentially numbered from 0 to N.\r
-*/\r
-\r
-const char *src_get_name (int converter_type) ;\r
-const char *src_get_description (int converter_type) ;\r
-const char *src_get_version (void) ;\r
-\r
-/*\r
-**     Set a new SRC ratio. This allows step responses\r
-**     in the conversion ratio.\r
-**     Returns non zero on error.\r
-*/\r
-\r
-int src_set_ratio (SRC_STATE *state, double new_ratio) ;\r
-\r
-/*\r
-**     Reset the internal SRC state.\r
-**     Does not modify the quality settings.\r
-**     Does not free any memory allocations.\r
-**     Returns non zero on error.\r
-*/\r
-\r
-int src_reset (SRC_STATE *state) ;\r
-\r
-/*\r
-** Return TRUE if ratio is a valid conversion ratio, FALSE\r
-** otherwise.\r
-*/\r
-\r
-int src_is_valid_ratio (double ratio) ;\r
-\r
-/*\r
-**     Return an error number.\r
-*/\r
-\r
-int src_error (SRC_STATE *state) ;\r
-\r
-/*\r
-**     Convert the error number into a string.\r
-*/\r
-const char* src_strerror (int error) ;\r
-\r
-/*\r
-** The following enums can be used to set the interpolator type\r
-** using the function src_set_converter().\r
-*/\r
-\r
-enum\r
-{\r
-       SRC_SINC_BEST_QUALITY           = 0,\r
-       SRC_SINC_MEDIUM_QUALITY         = 1,\r
-       SRC_SINC_FASTEST                        = 2,\r
-       SRC_ZERO_ORDER_HOLD                     = 3,\r
-       SRC_LINEAR                                      = 4\r
-} ;\r
-\r
-/*\r
-** Extra helper functions for converting from short to float and\r
-** back again.\r
-*/\r
-\r
-void src_short_to_float_array (const short *in, float *out, int len) ;\r
-void src_float_to_short_array (const float *in, short *out, int len) ;\r
-\r
-\r
-#ifdef __cplusplus\r
-}              /* extern "C" */\r
-#endif /* __cplusplus */\r
-\r
-#endif /* SAMPLERATE_H */\r
-\r
-/*\r
-** Do not edit or modify anything in this comment block.\r
-** The arch-tag line is a file identity tag for the GNU Arch\r
-** revision control system.\r
-**\r
-** arch-tag: 5421ef3e-c898-4ec3-8671-ea03d943ee00\r
-*/\r
-\r
+/*
+** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** 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
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/*
+** API documentation is available here:
+**     http://www.mega-nerd.com/SRC/api.html
+*/
+
+#ifndef SAMPLERATE_H
+#define SAMPLERATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Opaque data type SRC_STATE. */
+typedef struct SRC_STATE_tag SRC_STATE ;
+
+/* SRC_DATA is used to pass data to src_simple() and src_process(). */
+typedef struct
+{      float   *data_in, *data_out ;
+
+       long    input_frames, output_frames ;
+       long    input_frames_used, output_frames_gen ;
+
+       int             end_of_input ;
+
+       double  src_ratio ;
+} SRC_DATA ;
+
+/* SRC_CB_DATA is used with callback based API. */
+typedef struct
+{      long    frames ;
+       float   *data_in ;
+} SRC_CB_DATA ;
+
+/*
+** User supplied callback function type for use with src_callback_new()
+** and src_callback_read(). First parameter is the same pointer that was
+** passed into src_callback_new(). Second parameter is pointer to a
+** pointer. The user supplied callback function must modify *data to
+** point to the start of the user supplied float array. The user supplied
+** function must return the number of frames that **data points to.
+*/
+
+typedef long (*src_callback_t) (void *cb_data, float **data) ;
+
+/*
+**     Standard initialisation function : return an anonymous pointer to the
+**     internal state of the converter. Choose a converter from the enums below.
+**     Error returned in *error.
+*/
+
+SRC_STATE* src_new (int converter_type, int channels, int *error) ;
+
+/*
+**     Initilisation for callback based API : return an anonymous pointer to the
+**     internal state of the converter. Choose a converter from the enums below.
+**     The cb_data pointer can point to any data or be set to NULL. Whatever the
+**     value, when processing, user supplied function "func" gets called with
+**     cb_data as first parameter.
+*/
+
+SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels,
+                               int *error, void* cb_data) ;
+
+/*
+**     Cleanup all internal allocations.
+**     Always returns NULL.
+*/
+
+SRC_STATE* src_delete (SRC_STATE *state) ;
+
+/*
+**     Standard processing function.
+**     Returns non zero on error.
+*/
+
+int src_process (SRC_STATE *state, SRC_DATA *data) ;
+
+/*
+**     Callback based processing function. Read up to frames worth of data from
+**     the converter int *data and return frames read or -1 on error.
+*/
+long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) ;
+
+/*
+**     Simple interface for performing a single conversion from input buffer to
+**     output buffer at a fixed conversion ratio.
+**     Simple interface does not require initialisation as it can only operate on
+**     a single buffer worth of audio.
+*/
+
+int src_simple (SRC_DATA *data, int converter_type, int channels) ;
+
+/*
+** This library contains a number of different sample rate converters,
+** numbered 0 through N.
+**
+** Return a string giving either a name or a more full description of each
+** sample rate converter or NULL if no sample rate converter exists for
+** the given value. The converters are sequentially numbered from 0 to N.
+*/
+
+const char *src_get_name (int converter_type) ;
+const char *src_get_description (int converter_type) ;
+const char *src_get_version (void) ;
+
+/*
+**     Set a new SRC ratio. This allows step responses
+**     in the conversion ratio.
+**     Returns non zero on error.
+*/
+
+int src_set_ratio (SRC_STATE *state, double new_ratio) ;
+
+/*
+**     Reset the internal SRC state.
+**     Does not modify the quality settings.
+**     Does not free any memory allocations.
+**     Returns non zero on error.
+*/
+
+int src_reset (SRC_STATE *state) ;
+
+/*
+** Return TRUE if ratio is a valid conversion ratio, FALSE
+** otherwise.
+*/
+
+int src_is_valid_ratio (double ratio) ;
+
+/*
+**     Return an error number.
+*/
+
+int src_error (SRC_STATE *state) ;
+
+/*
+**     Convert the error number into a string.
+*/
+const char* src_strerror (int error) ;
+
+/*
+** The following enums can be used to set the interpolator type
+** using the function src_set_converter().
+*/
+
+enum
+{
+       SRC_SINC_BEST_QUALITY           = 0,
+       SRC_SINC_MEDIUM_QUALITY         = 1,
+       SRC_SINC_FASTEST                        = 2,
+       SRC_ZERO_ORDER_HOLD                     = 3,
+       SRC_LINEAR                                      = 4
+} ;
+
+/*
+** Extra helper functions for converting from short to float and
+** back again.
+*/
+
+void src_short_to_float_array (const short *in, float *out, int len) ;
+void src_float_to_short_array (const float *in, short *out, int len) ;
+
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* SAMPLERATE_H */
+
+/*
+** Do not edit or modify anything in this comment block.
+** The arch-tag line is a file identity tag for the GNU Arch
+** revision control system.
+**
+** arch-tag: 5421ef3e-c898-4ec3-8671-ea03d943ee00
+*/
+
index 340526f61b83913eac2d0edc48bd94d644f6e333..012d4ce41dd76687033056ecbe815a9e31ae824d 100644 (file)
-static unsigned char myfont[] = {\r
-       0x00,0x00,0x00,0x00,0x20,0x00,0x53,0x01,\r
-       0x20,0x00,0x0e,0x02,0xdc,0x04,0x00,0x00,\r
-       0xf1,0x04,0x00,0x00,0x06,0x05,0x00,0x00,\r
-       0x1b,0x05,0x00,0x00,0x30,0x05,0x00,0x00,\r
-       0x45,0x05,0x00,0x00,0x5a,0x05,0x00,0x00,\r
-       0x6f,0x05,0x00,0x00,0x84,0x05,0x00,0x00,\r
-       0x99,0x05,0x00,0x00,0xae,0x05,0x00,0x00,\r
-       0xc3,0x05,0x00,0x00,0xd8,0x05,0x00,0x00,\r
-       0xed,0x05,0x00,0x00,0x02,0x06,0x00,0x00,\r
-       0x17,0x06,0x00,0x00,0x2c,0x06,0x00,0x00,\r
-       0x41,0x06,0x00,0x00,0x56,0x06,0x00,0x00,\r
-       0x6b,0x06,0x00,0x00,0x80,0x06,0x00,0x00,\r
-       0x95,0x06,0x00,0x00,0xaa,0x06,0x00,0x00,\r
-       0xbf,0x06,0x00,0x00,0xd4,0x06,0x00,0x00,\r
-       0xe9,0x06,0x00,0x00,0xfe,0x06,0x00,0x00,\r
-       0x13,0x07,0x00,0x00,0x28,0x07,0x00,0x00,\r
-       0x3d,0x07,0x00,0x00,0x52,0x07,0x00,0x00,\r
-       0x67,0x07,0x00,0x00,0x7c,0x07,0x00,0x00,\r
-       0x91,0x07,0x00,0x00,0xa6,0x07,0x00,0x00,\r
-       0xbb,0x07,0x00,0x00,0xd0,0x07,0x00,0x00,\r
-       0xe5,0x07,0x00,0x00,0xfa,0x07,0x00,0x00,\r
-       0x0f,0x08,0x00,0x00,0x24,0x08,0x00,0x00,\r
-       0x39,0x08,0x00,0x00,0x4e,0x08,0x00,0x00,\r
-       0x63,0x08,0x00,0x00,0x78,0x08,0x00,0x00,\r
-       0x8d,0x08,0x00,0x00,0xa2,0x08,0x00,0x00,\r
-       0xb7,0x08,0x00,0x00,0xcc,0x08,0x00,0x00,\r
-       0xe1,0x08,0x00,0x00,0xf6,0x08,0x00,0x00,\r
-       0x0b,0x09,0x00,0x00,0x20,0x09,0x00,0x00,\r
-       0x35,0x09,0x00,0x00,0x4a,0x09,0x00,0x00,\r
-       0x5f,0x09,0x00,0x00,0x74,0x09,0x00,0x00,\r
-       0x89,0x09,0x00,0x00,0x9e,0x09,0x00,0x00,\r
-       0xb3,0x09,0x00,0x00,0xc8,0x09,0x00,0x00,\r
-       0xdd,0x09,0x00,0x00,0xf2,0x09,0x00,0x00,\r
-       0x07,0x0a,0x00,0x00,0x1c,0x0a,0x00,0x00,\r
-       0x31,0x0a,0x00,0x00,0x46,0x0a,0x00,0x00,\r
-       0x5b,0x0a,0x00,0x00,0x70,0x0a,0x00,0x00,\r
-       0x85,0x0a,0x00,0x00,0x9a,0x0a,0x00,0x00,\r
-       0xaf,0x0a,0x00,0x00,0xc4,0x0a,0x00,0x00,\r
-       0xd9,0x0a,0x00,0x00,0xee,0x0a,0x00,0x00,\r
-       0x03,0x0b,0x00,0x00,0x18,0x0b,0x00,0x00,\r
-       0x2d,0x0b,0x00,0x00,0x42,0x0b,0x00,0x00,\r
-       0x57,0x0b,0x00,0x00,0x6c,0x0b,0x00,0x00,\r
-       0x81,0x0b,0x00,0x00,0x96,0x0b,0x00,0x00,\r
-       0xab,0x0b,0x00,0x00,0xc0,0x0b,0x00,0x00,\r
-       0xd5,0x0b,0x00,0x00,0xea,0x0b,0x00,0x00,\r
-       0xff,0x0b,0x00,0x00,0x14,0x0c,0x00,0x00,\r
-       0x29,0x0c,0x00,0x00,0x3e,0x0c,0x00,0x00,\r
-       0x53,0x0c,0x00,0x00,0x68,0x0c,0x00,0x00,\r
-       0x7d,0x0c,0x00,0x00,0x92,0x0c,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0xa7,0x0c,0x00,0x00,\r
-       0xbc,0x0c,0x00,0x00,0xd1,0x0c,0x00,0x00,\r
-       0xe6,0x0c,0x00,0x00,0xfb,0x0c,0x00,0x00,\r
-       0x10,0x0d,0x00,0x00,0x25,0x0d,0x00,0x00,\r
-       0x3a,0x0d,0x00,0x00,0x4f,0x0d,0x00,0x00,\r
-       0x64,0x0d,0x00,0x00,0x79,0x0d,0x00,0x00,\r
-       0x8e,0x0d,0x00,0x00,0xa3,0x0d,0x00,0x00,\r
-       0xb8,0x0d,0x00,0x00,0xcd,0x0d,0x00,0x00,\r
-       0xe2,0x0d,0x00,0x00,0xf7,0x0d,0x00,0x00,\r
-       0x0c,0x0e,0x00,0x00,0x21,0x0e,0x00,0x00,\r
-       0x36,0x0e,0x00,0x00,0x4b,0x0e,0x00,0x00,\r
-       0x60,0x0e,0x00,0x00,0x75,0x0e,0x00,0x00,\r
-       0x8a,0x0e,0x00,0x00,0x9f,0x0e,0x00,0x00,\r
-       0xb4,0x0e,0x00,0x00,0xc9,0x0e,0x00,0x00,\r
-       0xde,0x0e,0x00,0x00,0xf3,0x0e,0x00,0x00,\r
-       0x08,0x0f,0x00,0x00,0x1d,0x0f,0x00,0x00,\r
-       0x32,0x0f,0x00,0x00,0x47,0x0f,0x00,0x00,\r
-       0x5c,0x0f,0x00,0x00,0x71,0x0f,0x00,0x00,\r
-       0x86,0x0f,0x00,0x00,0x9b,0x0f,0x00,0x00,\r
-       0xb0,0x0f,0x00,0x00,0xc5,0x0f,0x00,0x00,\r
-       0xda,0x0f,0x00,0x00,0xef,0x0f,0x00,0x00,\r
-       0x04,0x10,0x00,0x00,0x19,0x10,0x00,0x00,\r
-       0x2e,0x10,0x00,0x00,0x43,0x10,0x00,0x00,\r
-       0x58,0x10,0x00,0x00,0x6d,0x10,0x00,0x00,\r
-       0x82,0x10,0x00,0x00,0x97,0x10,0x00,0x00,\r
-       0xac,0x10,0x00,0x00,0xc1,0x10,0x00,0x00,\r
-       0xd6,0x10,0x00,0x00,0xeb,0x10,0x00,0x00,\r
-       0x00,0x11,0x00,0x00,0x15,0x11,0x00,0x00,\r
-       0x2a,0x11,0x00,0x00,0x3f,0x11,0x00,0x00,\r
-       0x54,0x11,0x00,0x00,0x69,0x11,0x00,0x00,\r
-       0x7e,0x11,0x00,0x00,0x93,0x11,0x00,0x00,\r
-       0xa8,0x11,0x00,0x00,0xbd,0x11,0x00,0x00,\r
-       0xd2,0x11,0x00,0x00,0xe7,0x11,0x00,0x00,\r
-       0xfc,0x11,0x00,0x00,0x11,0x12,0x00,0x00,\r
-       0x26,0x12,0x00,0x00,0x3b,0x12,0x00,0x00,\r
-       0x50,0x12,0x00,0x00,0x65,0x12,0x00,0x00,\r
-       0x7a,0x12,0x00,0x00,0x8f,0x12,0x00,0x00,\r
-       0xa4,0x12,0x00,0x00,0xb9,0x12,0x00,0x00,\r
-       0xce,0x12,0x00,0x00,0xe3,0x12,0x00,0x00,\r
-       0xf8,0x12,0x00,0x00,0x0d,0x13,0x00,0x00,\r
-       0x22,0x13,0x00,0x00,0x37,0x13,0x00,0x00,\r
-       0x4c,0x13,0x00,0x00,0x61,0x13,0x00,0x00,\r
-       0x76,0x13,0x00,0x00,0x8b,0x13,0x00,0x00,\r
-       0xa0,0x13,0x00,0x00,0xb5,0x13,0x00,0x00,\r
-       0xca,0x13,0x00,0x00,0xdf,0x13,0x00,0x00,\r
-       0xf4,0x13,0x00,0x00,0x09,0x14,0x00,0x00,\r
-       0x1e,0x14,0x00,0x00,0x33,0x14,0x00,0x00,\r
-       0x48,0x14,0x00,0x00,0x5d,0x14,0x00,0x00,\r
-       0x72,0x14,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x87,0x14,0x00,0x00,\r
-       0x9c,0x14,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,\r
-       0x08,0x00,0x08,0x08,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x22,0x22,0x22,\r
-       0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x12,0x12,0x12,0x7e,\r
-       0x24,0x24,0x7e,0x48,0x48,0x48,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x08,0x3e,0x49,0x48,0x38,0x0e,0x09,\r
-       0x49,0x3e,0x08,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x31,0x4a,\r
-       0x4a,0x34,0x08,0x08,0x16,0x29,0x29,0x46,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,\r
-       0x39,0x45,0x42,0x46,0x39,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x08,0x08,\r
-       0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x04,0x08,0x08,0x10,\r
-       0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x20,0x10,0x10,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x10,0x10,0x20,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x08,0x49,0x2a,0x1c,0x2a,0x49,0x08,\r
-       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,\r
-       0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x18,0x08,0x08,0x10,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x02,0x02,0x04,0x08,0x08,0x10,0x10,0x20,\r
-       0x40,0x40,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x18,0x24,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x08,0x18,0x28,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x3e,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x3c,\r
-       0x42,0x42,0x02,0x0c,0x10,0x20,0x40,0x40,\r
-       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x02,\r
-       0x1c,0x02,0x02,0x42,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x04,0x0c,0x14,0x24,0x44,0x44,0x7e,\r
-       0x04,0x04,0x04,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x7e,0x40,\r
-       0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,\r
-       0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x7e,0x02,0x02,0x04,0x04,0x04,0x08,0x08,\r
-       0x08,0x08,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,\r
-       0x42,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x3c,0x42,0x42,0x42,0x3e,0x02,\r
-       0x02,0x02,0x04,0x38,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,\r
-       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,\r
-       0x00,0x00,0x00,0x18,0x08,0x08,0x10,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x10,\r
-       0x08,0x04,0x02,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x08,\r
-       0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x3c,0x42,0x42,0x02,0x04,0x08,0x08,0x00,\r
-       0x08,0x08,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x1c,0x22,0x4a,\r
-       0x56,0x52,0x52,0x52,0x4e,0x20,0x1e,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x18,0x24,0x24,0x42,0x42,0x7e,\r
-       0x42,0x42,0x42,0x42,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x7c,\r
-       0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0x42,\r
-       0x7c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,\r
-       0x40,0x40,0x40,0x42,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x78,0x44,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x44,0x78,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x7e,0x40,\r
-       0x40,0x40,0x7c,0x40,0x40,0x40,0x40,0x7e,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x7e,0x40,0x40,0x40,0x7c,\r
-       0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,\r
-       0x46,0x3a,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x42,0x42,0x42,\r
-       0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x3e,0x08,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x3e,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x1f,\r
-       0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,\r
-       0x38,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,\r
-       0x60,0x60,0x50,0x48,0x44,0x42,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,\r
-       0x40,0x40,0x7e,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x42,0x42,\r
-       0x66,0x66,0x5a,0x5a,0x42,0x42,0x42,0x42,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x42,0x62,0x62,0x52,0x52,\r
-       0x4a,0x4a,0x46,0x46,0x42,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,\r
-       0x42,0x7c,0x40,0x40,0x40,0x40,0x40,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x5a,0x66,0x3c,0x03,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x7c,\r
-       0x42,0x42,0x42,0x7c,0x48,0x44,0x44,0x42,\r
-       0x42,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,\r
-       0x30,0x0c,0x02,0x42,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x7f,0x08,0x08,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x42,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x41,0x41,0x41,0x22,0x22,\r
-       0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x42,0x42,0x42,0x42,0x5a,0x5a,0x66,0x66,\r
-       0x42,0x42,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x42,0x42,0x24,\r
-       0x24,0x18,0x18,0x24,0x24,0x42,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x41,0x41,0x22,0x22,0x14,0x08,\r
-       0x08,0x08,0x08,0x08,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x7e,\r
-       0x02,0x02,0x04,0x08,0x10,0x20,0x40,0x40,\r
-       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x0e,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x08,0x08,0x08,0x0e,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x40,0x40,0x20,0x10,0x10,0x08,0x08,\r
-       0x04,0x02,0x02,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x70,0x10,0x10,\r
-       0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,\r
-       0x70,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x18,0x24,0x42,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x7f,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x18,0x10,0x10,0x08,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x3c,0x42,0x02,0x3e,\r
-       0x42,0x42,0x46,0x3a,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x40,0x40,\r
-       0x40,0x5c,0x62,0x42,0x42,0x42,0x42,0x62,\r
-       0x5c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,\r
-       0x40,0x40,0x40,0x40,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x02,0x02,0x02,0x3a,0x46,0x42,0x42,0x42,\r
-       0x42,0x46,0x3a,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x3c,0x42,0x42,0x7e,0x40,0x40,0x42,0x3c,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x0c,0x10,0x10,0x10,0x7c,0x10,\r
-       0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x02,0x3a,0x44,0x44,0x44,0x38,0x20,\r
-       0x3c,0x42,0x42,0x3c,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x40,0x40,0x40,0x5c,\r
-       0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x3e,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x04,0x04,\r
-       0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x04,\r
-       0x04,0x48,0x30,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x40,0x40,0x44,0x48,\r
-       0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x3e,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x76,0x49,0x49,0x49,0x49,0x49,0x49,0x49,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x5c,0x62,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,\r
-       0x62,0x42,0x42,0x42,0x42,0x62,0x5c,0x40,\r
-       0x40,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x3a,0x46,0x42,0x42,\r
-       0x42,0x42,0x46,0x3a,0x02,0x02,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x5c,0x62,0x42,0x40,0x40,0x40,0x40,\r
-       0x40,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,\r
-       0x40,0x30,0x0c,0x02,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,\r
-       0x10,0x10,0x0c,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x42,0x42,0x42,0x42,0x42,0x42,0x46,0x3a,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,\r
-       0x24,0x24,0x24,0x18,0x18,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x41,0x49,0x49,0x49,0x49,0x49,\r
-       0x49,0x36,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x42,\r
-       0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,\r
-       0x42,0x26,0x1a,0x02,0x02,0x3c,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x7e,0x02,0x04,0x08,0x10,0x20,0x40,\r
-       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x0c,0x10,0x10,0x08,0x08,\r
-       0x10,0x10,0x08,0x08,0x10,0x10,0x0c,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x08,\r
-       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x30,0x08,0x08,\r
-       0x10,0x10,0x08,0x08,0x10,0x10,0x08,0x08,\r
-       0x30,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x31,0x49,0x46,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x08,0x08,0x00,\r
-       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x00,0x00,0x08,0x08,0x3e,0x49,0x48,0x48,\r
-       0x49,0x3e,0x08,0x08,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x0e,\r
-       0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x3e,\r
-       0x61,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x00,0x42,0x24,0x3c,\r
-       0x24,0x24,0x3c,0x24,0x42,0x00,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x41,0x22,0x14,0x08,0x7f,0x08,0x7f,\r
-       0x08,0x08,0x08,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x08,0x08,\r
-       0x08,0x08,0x00,0x00,0x08,0x08,0x08,0x08,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x3c,0x42,0x40,0x3c,0x42,\r
-       0x42,0x3c,0x02,0x42,0x3c,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x24,0x24,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x3c,0x42,0x99,\r
-       0xa5,0xa1,0xa1,0xa5,0x99,0x42,0x3c,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x1c,0x02,0x1e,0x22,0x1e,0x00,0x3e,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,\r
-       0x12,0x12,0x24,0x24,0x48,0x24,0x24,0x12,\r
-       0x12,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x7e,0x02,0x02,0x02,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x3c,0x42,\r
-       0xb9,0xa5,0xa5,0xb9,0xa9,0xa5,0x42,0x3c,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x10,0x28,0x28,0x10,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x08,0x08,0x08,\r
-       0x7f,0x08,0x08,0x08,0x00,0x7f,0x00,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x1c,0x22,0x02,0x1c,0x20,0x20,0x3e,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x1c,0x22,0x02,\r
-       0x1c,0x02,0x22,0x1c,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x0c,0x30,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x22,0x22,0x22,\r
-       0x22,0x36,0x2a,0x20,0x20,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x3e,0x7a,0x7a,\r
-       0x7a,0x7a,0x3a,0x0a,0x0a,0x0a,0x0a,0x0a,\r
-       0x0e,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,\r
-       0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x00,0x08,0x30,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x08,0x18,0x28,0x08,0x08,\r
-       0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x1c,0x22,0x22,0x22,0x1c,0x00,0x3e,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,\r
-       0x48,0x48,0x24,0x24,0x12,0x24,0x24,0x48,\r
-       0x48,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x00,0x00,0x22,0x62,0x24,0x28,\r
-       0x28,0x12,0x16,0x2a,0x4e,0x42,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,\r
-       0x00,0x22,0x62,0x24,0x28,0x28,0x14,0x1a,\r
-       0x22,0x44,0x4e,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x62,0x12,\r
-       0x24,0x18,0x68,0x12,0x16,0x2a,0x4e,0x42,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x08,0x08,0x00,0x08,0x08,\r
-       0x30,0x42,0x42,0x42,0x3c,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x30,0x0c,0x00,0x00,\r
-       0x18,0x24,0x24,0x42,0x42,0x7e,0x42,0x42,\r
-       0x42,0x42,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x0c,0x30,0x00,0x00,0x18,0x24,0x24,\r
-       0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x18,0x24,\r
-       0x00,0x00,0x18,0x24,0x24,0x42,0x42,0x7e,\r
-       0x42,0x42,0x42,0x42,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x32,0x4c,0x00,0x00,0x18,\r
-       0x24,0x24,0x42,0x42,0x7e,0x42,0x42,0x42,\r
-       0x42,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x24,0x24,0x00,0x00,0x18,0x24,0x24,0x42,\r
-       0x42,0x7e,0x42,0x42,0x42,0x42,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x18,0x24,0x18,\r
-       0x00,0x18,0x24,0x24,0x42,0x42,0x7e,0x42,\r
-       0x42,0x42,0x42,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x1f,0x28,\r
-       0x48,0x48,0x7f,0x48,0x48,0x48,0x48,0x4f,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x3c,0x42,0x42,0x40,0x40,\r
-       0x40,0x40,0x42,0x42,0x3c,0x08,0x30,0x08,\r
-       0x08,0x10,0x00,0xfe,0x30,0x0c,0x00,0x00,\r
-       0x7e,0x40,0x40,0x40,0x7c,0x40,0x40,0x40,\r
-       0x40,0x7e,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x0c,0x30,0x00,0x00,0x7e,0x40,0x40,\r
-       0x40,0x7c,0x40,0x40,0x40,0x40,0x7e,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x18,0x24,\r
-       0x00,0x00,0x7e,0x40,0x40,0x40,0x7c,0x40,\r
-       0x40,0x40,0x40,0x7e,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x24,0x24,0x00,0x00,0x7e,\r
-       0x40,0x40,0x40,0x7c,0x40,0x40,0x40,0x40,\r
-       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x18,0x06,0x00,0x00,0x3e,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x0c,0x30,0x00,\r
-       0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x3e,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x18,0x24,0x00,0x00,0x3e,0x08,\r
-       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3e,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x24,\r
-       0x24,0x00,0x00,0x3e,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x78,0x44,0x42,0x42,0xf2,0x42,0x42,0x42,\r
-       0x44,0x78,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x32,0x4c,0x00,0x00,0x42,0x62,0x62,\r
-       0x52,0x52,0x4a,0x4a,0x46,0x46,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x30,0x0c,\r
-       0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x42,0x42,0x3c,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x0c,0x30,0x00,0x00,0x3c,\r
-       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,\r
-       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x18,0x24,0x00,0x00,0x3c,0x42,0x42,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x32,0x4c,0x00,\r
-       0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x42,0x3c,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x24,0x24,0x00,0x00,0x3c,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x24,\r
-       0x18,0x24,0x42,0x00,0x00,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x02,\r
-       0x3a,0x44,0x46,0x4a,0x4a,0x52,0x52,0x62,\r
-       0x22,0x5c,0x40,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x30,0x0c,0x00,0x00,0x42,0x42,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x0c,0x30,\r
-       0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,\r
-       0x42,0x42,0x42,0x3c,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x18,0x24,0x00,0x00,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,\r
-       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x24,0x24,0x00,0x00,0x42,0x42,0x42,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x0c,0x30,0x00,\r
-       0x00,0x41,0x41,0x22,0x22,0x14,0x08,0x08,\r
-       0x08,0x08,0x08,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x40,0x40,0x78,\r
-       0x44,0x42,0x42,0x44,0x78,0x40,0x40,0x40,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x7c,\r
-       0x42,0x42,0x42,0x62,0x5c,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x30,0x0c,\r
-       0x00,0x00,0x3c,0x42,0x02,0x3e,0x42,0x42,\r
-       0x46,0x3a,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x0c,0x30,0x00,0x00,0x3c,\r
-       0x42,0x02,0x3e,0x42,0x42,0x46,0x3a,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x18,0x24,0x00,0x00,0x3c,0x42,0x02,0x3e,\r
-       0x42,0x42,0x46,0x3a,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x32,0x4c,0x00,\r
-       0x00,0x3c,0x42,0x02,0x3e,0x42,0x42,0x46,\r
-       0x3a,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x24,0x24,0x00,0x00,0x3c,0x42,\r
-       0x02,0x3e,0x42,0x42,0x46,0x3a,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x18,0x24,\r
-       0x18,0x00,0x00,0x3c,0x42,0x02,0x3e,0x42,\r
-       0x42,0x46,0x3a,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,\r
-       0x3e,0x49,0x09,0x3f,0x48,0x48,0x49,0x3e,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,\r
-       0x40,0x40,0x40,0x42,0x3c,0x08,0x30,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x30,0x0c,\r
-       0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,\r
-       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x0c,0x30,0x00,0x00,0x3c,\r
-       0x42,0x42,0x7e,0x40,0x40,0x42,0x3c,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x18,0x24,0x00,0x00,0x3c,0x42,0x42,0x7e,\r
-       0x40,0x40,0x42,0x3c,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x24,0x24,0x00,\r
-       0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x42,\r
-       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x30,0x0c,0x00,0x00,0x18,0x08,\r
-       0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x0c,\r
-       0x30,0x00,0x00,0x18,0x08,0x08,0x08,0x08,\r
-       0x08,0x08,0x3e,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x18,0x24,0x00,0x00,\r
-       0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x3e,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x24,0x24,0x00,0x00,0x18,0x08,0x08,\r
-       0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x32,0x0c,\r
-       0x14,0x22,0x02,0x3e,0x42,0x42,0x42,0x42,\r
-       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x32,0x4c,0x00,0x00,0x5c,\r
-       0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x30,0x0c,0x00,0x00,0x3c,0x42,0x42,0x42,\r
-       0x42,0x42,0x42,0x3c,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x0c,0x30,0x00,\r
-       0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,\r
-       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x18,0x24,0x00,0x00,0x3c,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x32,\r
-       0x4c,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,\r
-       0x42,0x42,0x3c,0x00,0x00,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x24,0x24,0x00,0x00,\r
-       0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,\r
-       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,\r
-       0x7e,0x00,0x00,0x18,0x00,0x00,0x00,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x00,0x02,0x3c,0x46,0x4a,0x4a,0x52,0x52,\r
-       0x62,0x3c,0x40,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x30,0x0c,0x00,0x00,0x42,\r
-       0x42,0x42,0x42,0x42,0x42,0x46,0x3a,0x00,\r
-       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,\r
-       0x0c,0x30,0x00,0x00,0x42,0x42,0x42,0x42,\r
-       0x42,0x42,0x46,0x3a,0x00,0x00,0x08,0x08,\r
-       0x10,0x00,0xfe,0x00,0x00,0x18,0x24,0x00,\r
-       0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x46,\r
-       0x3a,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,\r
-       0x00,0x00,0x24,0x24,0x00,0x00,0x42,0x42,\r
-       0x42,0x42,0x42,0x42,0x46,0x3a,0x00,0x00,\r
-       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x0c,\r
-       0x30,0x00,0x00,0x42,0x42,0x42,0x42,0x42,\r
-       0x26,0x1a,0x02,0x02,0x3c,0x08,0x08,0x10,\r
-       0x00,0xfe,0x00,0x00,0x00,0x00,0x20,0x20,\r
-       0x3c,0x22,0x22,0x22,0x24,0x28,0x30,0x20,\r
-       0x20,0x20,0x08,0x08,0x10,0x00,0xfe,0x00,\r
-       0x00,0x24,0x24,0x00,0x00,0x42,0x42,0x42,\r
-       0x42,0x42,0x26,0x1a,0x02,0x02,0x3c,0x08,\r
-       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,\r
-       0x6e,0x90,0x90,0x90,0x9c,0x90,0x90,0x90,\r
-       0x90,0x6e,0x00,0x00,0x08,0x08,0x10,0x00,\r
-       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,\r
-       0x92,0x92,0x9e,0x90,0x90,0x92,0x6c,0x00,\r
-       0x00};\r
-\r
-unsigned char * SF_defaultfont = &(myfont[0]);\r
-int SF_defaultfontsize = sizeof(myfont);\r
-\r
+static unsigned char myfont[] = {
+       0x00,0x00,0x00,0x00,0x20,0x00,0x53,0x01,
+       0x20,0x00,0x0e,0x02,0xdc,0x04,0x00,0x00,
+       0xf1,0x04,0x00,0x00,0x06,0x05,0x00,0x00,
+       0x1b,0x05,0x00,0x00,0x30,0x05,0x00,0x00,
+       0x45,0x05,0x00,0x00,0x5a,0x05,0x00,0x00,
+       0x6f,0x05,0x00,0x00,0x84,0x05,0x00,0x00,
+       0x99,0x05,0x00,0x00,0xae,0x05,0x00,0x00,
+       0xc3,0x05,0x00,0x00,0xd8,0x05,0x00,0x00,
+       0xed,0x05,0x00,0x00,0x02,0x06,0x00,0x00,
+       0x17,0x06,0x00,0x00,0x2c,0x06,0x00,0x00,
+       0x41,0x06,0x00,0x00,0x56,0x06,0x00,0x00,
+       0x6b,0x06,0x00,0x00,0x80,0x06,0x00,0x00,
+       0x95,0x06,0x00,0x00,0xaa,0x06,0x00,0x00,
+       0xbf,0x06,0x00,0x00,0xd4,0x06,0x00,0x00,
+       0xe9,0x06,0x00,0x00,0xfe,0x06,0x00,0x00,
+       0x13,0x07,0x00,0x00,0x28,0x07,0x00,0x00,
+       0x3d,0x07,0x00,0x00,0x52,0x07,0x00,0x00,
+       0x67,0x07,0x00,0x00,0x7c,0x07,0x00,0x00,
+       0x91,0x07,0x00,0x00,0xa6,0x07,0x00,0x00,
+       0xbb,0x07,0x00,0x00,0xd0,0x07,0x00,0x00,
+       0xe5,0x07,0x00,0x00,0xfa,0x07,0x00,0x00,
+       0x0f,0x08,0x00,0x00,0x24,0x08,0x00,0x00,
+       0x39,0x08,0x00,0x00,0x4e,0x08,0x00,0x00,
+       0x63,0x08,0x00,0x00,0x78,0x08,0x00,0x00,
+       0x8d,0x08,0x00,0x00,0xa2,0x08,0x00,0x00,
+       0xb7,0x08,0x00,0x00,0xcc,0x08,0x00,0x00,
+       0xe1,0x08,0x00,0x00,0xf6,0x08,0x00,0x00,
+       0x0b,0x09,0x00,0x00,0x20,0x09,0x00,0x00,
+       0x35,0x09,0x00,0x00,0x4a,0x09,0x00,0x00,
+       0x5f,0x09,0x00,0x00,0x74,0x09,0x00,0x00,
+       0x89,0x09,0x00,0x00,0x9e,0x09,0x00,0x00,
+       0xb3,0x09,0x00,0x00,0xc8,0x09,0x00,0x00,
+       0xdd,0x09,0x00,0x00,0xf2,0x09,0x00,0x00,
+       0x07,0x0a,0x00,0x00,0x1c,0x0a,0x00,0x00,
+       0x31,0x0a,0x00,0x00,0x46,0x0a,0x00,0x00,
+       0x5b,0x0a,0x00,0x00,0x70,0x0a,0x00,0x00,
+       0x85,0x0a,0x00,0x00,0x9a,0x0a,0x00,0x00,
+       0xaf,0x0a,0x00,0x00,0xc4,0x0a,0x00,0x00,
+       0xd9,0x0a,0x00,0x00,0xee,0x0a,0x00,0x00,
+       0x03,0x0b,0x00,0x00,0x18,0x0b,0x00,0x00,
+       0x2d,0x0b,0x00,0x00,0x42,0x0b,0x00,0x00,
+       0x57,0x0b,0x00,0x00,0x6c,0x0b,0x00,0x00,
+       0x81,0x0b,0x00,0x00,0x96,0x0b,0x00,0x00,
+       0xab,0x0b,0x00,0x00,0xc0,0x0b,0x00,0x00,
+       0xd5,0x0b,0x00,0x00,0xea,0x0b,0x00,0x00,
+       0xff,0x0b,0x00,0x00,0x14,0x0c,0x00,0x00,
+       0x29,0x0c,0x00,0x00,0x3e,0x0c,0x00,0x00,
+       0x53,0x0c,0x00,0x00,0x68,0x0c,0x00,0x00,
+       0x7d,0x0c,0x00,0x00,0x92,0x0c,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0xa7,0x0c,0x00,0x00,
+       0xbc,0x0c,0x00,0x00,0xd1,0x0c,0x00,0x00,
+       0xe6,0x0c,0x00,0x00,0xfb,0x0c,0x00,0x00,
+       0x10,0x0d,0x00,0x00,0x25,0x0d,0x00,0x00,
+       0x3a,0x0d,0x00,0x00,0x4f,0x0d,0x00,0x00,
+       0x64,0x0d,0x00,0x00,0x79,0x0d,0x00,0x00,
+       0x8e,0x0d,0x00,0x00,0xa3,0x0d,0x00,0x00,
+       0xb8,0x0d,0x00,0x00,0xcd,0x0d,0x00,0x00,
+       0xe2,0x0d,0x00,0x00,0xf7,0x0d,0x00,0x00,
+       0x0c,0x0e,0x00,0x00,0x21,0x0e,0x00,0x00,
+       0x36,0x0e,0x00,0x00,0x4b,0x0e,0x00,0x00,
+       0x60,0x0e,0x00,0x00,0x75,0x0e,0x00,0x00,
+       0x8a,0x0e,0x00,0x00,0x9f,0x0e,0x00,0x00,
+       0xb4,0x0e,0x00,0x00,0xc9,0x0e,0x00,0x00,
+       0xde,0x0e,0x00,0x00,0xf3,0x0e,0x00,0x00,
+       0x08,0x0f,0x00,0x00,0x1d,0x0f,0x00,0x00,
+       0x32,0x0f,0x00,0x00,0x47,0x0f,0x00,0x00,
+       0x5c,0x0f,0x00,0x00,0x71,0x0f,0x00,0x00,
+       0x86,0x0f,0x00,0x00,0x9b,0x0f,0x00,0x00,
+       0xb0,0x0f,0x00,0x00,0xc5,0x0f,0x00,0x00,
+       0xda,0x0f,0x00,0x00,0xef,0x0f,0x00,0x00,
+       0x04,0x10,0x00,0x00,0x19,0x10,0x00,0x00,
+       0x2e,0x10,0x00,0x00,0x43,0x10,0x00,0x00,
+       0x58,0x10,0x00,0x00,0x6d,0x10,0x00,0x00,
+       0x82,0x10,0x00,0x00,0x97,0x10,0x00,0x00,
+       0xac,0x10,0x00,0x00,0xc1,0x10,0x00,0x00,
+       0xd6,0x10,0x00,0x00,0xeb,0x10,0x00,0x00,
+       0x00,0x11,0x00,0x00,0x15,0x11,0x00,0x00,
+       0x2a,0x11,0x00,0x00,0x3f,0x11,0x00,0x00,
+       0x54,0x11,0x00,0x00,0x69,0x11,0x00,0x00,
+       0x7e,0x11,0x00,0x00,0x93,0x11,0x00,0x00,
+       0xa8,0x11,0x00,0x00,0xbd,0x11,0x00,0x00,
+       0xd2,0x11,0x00,0x00,0xe7,0x11,0x00,0x00,
+       0xfc,0x11,0x00,0x00,0x11,0x12,0x00,0x00,
+       0x26,0x12,0x00,0x00,0x3b,0x12,0x00,0x00,
+       0x50,0x12,0x00,0x00,0x65,0x12,0x00,0x00,
+       0x7a,0x12,0x00,0x00,0x8f,0x12,0x00,0x00,
+       0xa4,0x12,0x00,0x00,0xb9,0x12,0x00,0x00,
+       0xce,0x12,0x00,0x00,0xe3,0x12,0x00,0x00,
+       0xf8,0x12,0x00,0x00,0x0d,0x13,0x00,0x00,
+       0x22,0x13,0x00,0x00,0x37,0x13,0x00,0x00,
+       0x4c,0x13,0x00,0x00,0x61,0x13,0x00,0x00,
+       0x76,0x13,0x00,0x00,0x8b,0x13,0x00,0x00,
+       0xa0,0x13,0x00,0x00,0xb5,0x13,0x00,0x00,
+       0xca,0x13,0x00,0x00,0xdf,0x13,0x00,0x00,
+       0xf4,0x13,0x00,0x00,0x09,0x14,0x00,0x00,
+       0x1e,0x14,0x00,0x00,0x33,0x14,0x00,0x00,
+       0x48,0x14,0x00,0x00,0x5d,0x14,0x00,0x00,
+       0x72,0x14,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x87,0x14,0x00,0x00,
+       0x9c,0x14,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,
+       0x08,0x00,0x08,0x08,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x22,0x22,0x22,
+       0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x12,0x12,0x12,0x7e,
+       0x24,0x24,0x7e,0x48,0x48,0x48,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x08,0x3e,0x49,0x48,0x38,0x0e,0x09,
+       0x49,0x3e,0x08,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x31,0x4a,
+       0x4a,0x34,0x08,0x08,0x16,0x29,0x29,0x46,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,
+       0x39,0x45,0x42,0x46,0x39,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x08,0x08,
+       0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x04,0x08,0x08,0x10,
+       0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x20,0x10,0x10,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x10,0x10,0x20,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x08,0x49,0x2a,0x1c,0x2a,0x49,0x08,
+       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,
+       0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x18,0x08,0x08,0x10,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x02,0x02,0x04,0x08,0x08,0x10,0x10,0x20,
+       0x40,0x40,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x18,0x24,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x08,0x18,0x28,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x3e,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x3c,
+       0x42,0x42,0x02,0x0c,0x10,0x20,0x40,0x40,
+       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x02,
+       0x1c,0x02,0x02,0x42,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x04,0x0c,0x14,0x24,0x44,0x44,0x7e,
+       0x04,0x04,0x04,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x7e,0x40,
+       0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,
+       0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x7e,0x02,0x02,0x04,0x04,0x04,0x08,0x08,
+       0x08,0x08,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,
+       0x42,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x3c,0x42,0x42,0x42,0x3e,0x02,
+       0x02,0x02,0x04,0x38,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,
+       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,
+       0x00,0x00,0x00,0x18,0x08,0x08,0x10,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x10,
+       0x08,0x04,0x02,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x08,
+       0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x3c,0x42,0x42,0x02,0x04,0x08,0x08,0x00,
+       0x08,0x08,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x1c,0x22,0x4a,
+       0x56,0x52,0x52,0x52,0x4e,0x20,0x1e,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x18,0x24,0x24,0x42,0x42,0x7e,
+       0x42,0x42,0x42,0x42,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x7c,
+       0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0x42,
+       0x7c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,
+       0x40,0x40,0x40,0x42,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x78,0x44,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x44,0x78,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x7e,0x40,
+       0x40,0x40,0x7c,0x40,0x40,0x40,0x40,0x7e,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x7e,0x40,0x40,0x40,0x7c,
+       0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,
+       0x46,0x3a,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x42,0x42,0x42,
+       0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x3e,0x08,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x3e,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x1f,
+       0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,
+       0x38,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,
+       0x60,0x60,0x50,0x48,0x44,0x42,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
+       0x40,0x40,0x7e,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x42,0x42,
+       0x66,0x66,0x5a,0x5a,0x42,0x42,0x42,0x42,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x42,0x62,0x62,0x52,0x52,
+       0x4a,0x4a,0x46,0x46,0x42,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,
+       0x42,0x7c,0x40,0x40,0x40,0x40,0x40,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x5a,0x66,0x3c,0x03,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x7c,
+       0x42,0x42,0x42,0x7c,0x48,0x44,0x44,0x42,
+       0x42,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,
+       0x30,0x0c,0x02,0x42,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x7f,0x08,0x08,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x42,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x41,0x41,0x41,0x22,0x22,
+       0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x42,0x42,0x42,0x42,0x5a,0x5a,0x66,0x66,
+       0x42,0x42,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x42,0x42,0x24,
+       0x24,0x18,0x18,0x24,0x24,0x42,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x41,0x41,0x22,0x22,0x14,0x08,
+       0x08,0x08,0x08,0x08,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x7e,
+       0x02,0x02,0x04,0x08,0x10,0x20,0x40,0x40,
+       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x0e,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x08,0x08,0x08,0x0e,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x40,0x40,0x20,0x10,0x10,0x08,0x08,
+       0x04,0x02,0x02,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x70,0x10,0x10,
+       0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
+       0x70,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x18,0x24,0x42,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x7f,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x18,0x10,0x10,0x08,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x3c,0x42,0x02,0x3e,
+       0x42,0x42,0x46,0x3a,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x40,0x40,
+       0x40,0x5c,0x62,0x42,0x42,0x42,0x42,0x62,
+       0x5c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,
+       0x40,0x40,0x40,0x40,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x02,0x02,0x02,0x3a,0x46,0x42,0x42,0x42,
+       0x42,0x46,0x3a,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x3c,0x42,0x42,0x7e,0x40,0x40,0x42,0x3c,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x0c,0x10,0x10,0x10,0x7c,0x10,
+       0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x02,0x3a,0x44,0x44,0x44,0x38,0x20,
+       0x3c,0x42,0x42,0x3c,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x40,0x40,0x40,0x5c,
+       0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x3e,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x04,0x04,
+       0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x04,
+       0x04,0x48,0x30,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x40,0x40,0x44,0x48,
+       0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x3e,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x76,0x49,0x49,0x49,0x49,0x49,0x49,0x49,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x5c,0x62,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,
+       0x62,0x42,0x42,0x42,0x42,0x62,0x5c,0x40,
+       0x40,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x3a,0x46,0x42,0x42,
+       0x42,0x42,0x46,0x3a,0x02,0x02,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x5c,0x62,0x42,0x40,0x40,0x40,0x40,
+       0x40,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,
+       0x40,0x30,0x0c,0x02,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,
+       0x10,0x10,0x0c,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x42,0x42,0x42,0x42,0x42,0x42,0x46,0x3a,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,
+       0x24,0x24,0x24,0x18,0x18,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x41,0x49,0x49,0x49,0x49,0x49,
+       0x49,0x36,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x42,
+       0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,
+       0x42,0x26,0x1a,0x02,0x02,0x3c,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x7e,0x02,0x04,0x08,0x10,0x20,0x40,
+       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x0c,0x10,0x10,0x08,0x08,
+       0x10,0x10,0x08,0x08,0x10,0x10,0x0c,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x08,
+       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x30,0x08,0x08,
+       0x10,0x10,0x08,0x08,0x10,0x10,0x08,0x08,
+       0x30,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x31,0x49,0x46,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x08,0x08,0x00,
+       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x00,0x00,0x08,0x08,0x3e,0x49,0x48,0x48,
+       0x49,0x3e,0x08,0x08,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x0e,
+       0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x3e,
+       0x61,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x00,0x42,0x24,0x3c,
+       0x24,0x24,0x3c,0x24,0x42,0x00,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x41,0x22,0x14,0x08,0x7f,0x08,0x7f,
+       0x08,0x08,0x08,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x08,0x08,
+       0x08,0x08,0x00,0x00,0x08,0x08,0x08,0x08,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x3c,0x42,0x40,0x3c,0x42,
+       0x42,0x3c,0x02,0x42,0x3c,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x24,0x24,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x3c,0x42,0x99,
+       0xa5,0xa1,0xa1,0xa5,0x99,0x42,0x3c,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x1c,0x02,0x1e,0x22,0x1e,0x00,0x3e,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
+       0x12,0x12,0x24,0x24,0x48,0x24,0x24,0x12,
+       0x12,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x7e,0x02,0x02,0x02,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x3c,0x42,
+       0xb9,0xa5,0xa5,0xb9,0xa9,0xa5,0x42,0x3c,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x10,0x28,0x28,0x10,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x08,0x08,0x08,
+       0x7f,0x08,0x08,0x08,0x00,0x7f,0x00,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x1c,0x22,0x02,0x1c,0x20,0x20,0x3e,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x1c,0x22,0x02,
+       0x1c,0x02,0x22,0x1c,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x0c,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x22,0x22,0x22,
+       0x22,0x36,0x2a,0x20,0x20,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x3e,0x7a,0x7a,
+       0x7a,0x7a,0x3a,0x0a,0x0a,0x0a,0x0a,0x0a,
+       0x0e,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,
+       0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x08,0x30,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x08,0x18,0x28,0x08,0x08,
+       0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x1c,0x22,0x22,0x22,0x1c,0x00,0x3e,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
+       0x48,0x48,0x24,0x24,0x12,0x24,0x24,0x48,
+       0x48,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x00,0x00,0x22,0x62,0x24,0x28,
+       0x28,0x12,0x16,0x2a,0x4e,0x42,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x00,
+       0x00,0x22,0x62,0x24,0x28,0x28,0x14,0x1a,
+       0x22,0x44,0x4e,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x62,0x12,
+       0x24,0x18,0x68,0x12,0x16,0x2a,0x4e,0x42,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x08,0x08,0x00,0x08,0x08,
+       0x30,0x42,0x42,0x42,0x3c,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x30,0x0c,0x00,0x00,
+       0x18,0x24,0x24,0x42,0x42,0x7e,0x42,0x42,
+       0x42,0x42,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x0c,0x30,0x00,0x00,0x18,0x24,0x24,
+       0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x18,0x24,
+       0x00,0x00,0x18,0x24,0x24,0x42,0x42,0x7e,
+       0x42,0x42,0x42,0x42,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x32,0x4c,0x00,0x00,0x18,
+       0x24,0x24,0x42,0x42,0x7e,0x42,0x42,0x42,
+       0x42,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x24,0x24,0x00,0x00,0x18,0x24,0x24,0x42,
+       0x42,0x7e,0x42,0x42,0x42,0x42,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x18,0x24,0x18,
+       0x00,0x18,0x24,0x24,0x42,0x42,0x7e,0x42,
+       0x42,0x42,0x42,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x1f,0x28,
+       0x48,0x48,0x7f,0x48,0x48,0x48,0x48,0x4f,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x3c,0x42,0x42,0x40,0x40,
+       0x40,0x40,0x42,0x42,0x3c,0x08,0x30,0x08,
+       0x08,0x10,0x00,0xfe,0x30,0x0c,0x00,0x00,
+       0x7e,0x40,0x40,0x40,0x7c,0x40,0x40,0x40,
+       0x40,0x7e,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x0c,0x30,0x00,0x00,0x7e,0x40,0x40,
+       0x40,0x7c,0x40,0x40,0x40,0x40,0x7e,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x18,0x24,
+       0x00,0x00,0x7e,0x40,0x40,0x40,0x7c,0x40,
+       0x40,0x40,0x40,0x7e,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x24,0x24,0x00,0x00,0x7e,
+       0x40,0x40,0x40,0x7c,0x40,0x40,0x40,0x40,
+       0x7e,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x18,0x06,0x00,0x00,0x3e,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x0c,0x30,0x00,
+       0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x3e,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x18,0x24,0x00,0x00,0x3e,0x08,
+       0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3e,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x24,
+       0x24,0x00,0x00,0x3e,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x78,0x44,0x42,0x42,0xf2,0x42,0x42,0x42,
+       0x44,0x78,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x32,0x4c,0x00,0x00,0x42,0x62,0x62,
+       0x52,0x52,0x4a,0x4a,0x46,0x46,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x30,0x0c,
+       0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x42,0x42,0x3c,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x0c,0x30,0x00,0x00,0x3c,
+       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x18,0x24,0x00,0x00,0x3c,0x42,0x42,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x32,0x4c,0x00,
+       0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x42,0x3c,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x24,0x24,0x00,0x00,0x3c,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x24,
+       0x18,0x24,0x42,0x00,0x00,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x02,
+       0x3a,0x44,0x46,0x4a,0x4a,0x52,0x52,0x62,
+       0x22,0x5c,0x40,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x30,0x0c,0x00,0x00,0x42,0x42,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x0c,0x30,
+       0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,
+       0x42,0x42,0x42,0x3c,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x18,0x24,0x00,0x00,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x24,0x24,0x00,0x00,0x42,0x42,0x42,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x0c,0x30,0x00,
+       0x00,0x41,0x41,0x22,0x22,0x14,0x08,0x08,
+       0x08,0x08,0x08,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x40,0x40,0x78,
+       0x44,0x42,0x42,0x44,0x78,0x40,0x40,0x40,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x7c,
+       0x42,0x42,0x42,0x62,0x5c,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x30,0x0c,
+       0x00,0x00,0x3c,0x42,0x02,0x3e,0x42,0x42,
+       0x46,0x3a,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x0c,0x30,0x00,0x00,0x3c,
+       0x42,0x02,0x3e,0x42,0x42,0x46,0x3a,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x18,0x24,0x00,0x00,0x3c,0x42,0x02,0x3e,
+       0x42,0x42,0x46,0x3a,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x32,0x4c,0x00,
+       0x00,0x3c,0x42,0x02,0x3e,0x42,0x42,0x46,
+       0x3a,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x24,0x24,0x00,0x00,0x3c,0x42,
+       0x02,0x3e,0x42,0x42,0x46,0x3a,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x18,0x24,
+       0x18,0x00,0x00,0x3c,0x42,0x02,0x3e,0x42,
+       0x42,0x46,0x3a,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x3e,0x49,0x09,0x3f,0x48,0x48,0x49,0x3e,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,
+       0x40,0x40,0x40,0x42,0x3c,0x08,0x30,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x30,0x0c,
+       0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,
+       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x0c,0x30,0x00,0x00,0x3c,
+       0x42,0x42,0x7e,0x40,0x40,0x42,0x3c,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x18,0x24,0x00,0x00,0x3c,0x42,0x42,0x7e,
+       0x40,0x40,0x42,0x3c,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x24,0x24,0x00,
+       0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x42,
+       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x30,0x0c,0x00,0x00,0x18,0x08,
+       0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x0c,
+       0x30,0x00,0x00,0x18,0x08,0x08,0x08,0x08,
+       0x08,0x08,0x3e,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x18,0x24,0x00,0x00,
+       0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x3e,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x24,0x24,0x00,0x00,0x18,0x08,0x08,
+       0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x32,0x0c,
+       0x14,0x22,0x02,0x3e,0x42,0x42,0x42,0x42,
+       0x42,0x3c,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x32,0x4c,0x00,0x00,0x5c,
+       0x62,0x42,0x42,0x42,0x42,0x42,0x42,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x30,0x0c,0x00,0x00,0x3c,0x42,0x42,0x42,
+       0x42,0x42,0x42,0x3c,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x0c,0x30,0x00,
+       0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,
+       0x3c,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x18,0x24,0x00,0x00,0x3c,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x32,
+       0x4c,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,
+       0x42,0x42,0x3c,0x00,0x00,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x24,0x24,0x00,0x00,
+       0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,
+       0x00,0x00,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,
+       0x7e,0x00,0x00,0x18,0x00,0x00,0x00,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x00,0x02,0x3c,0x46,0x4a,0x4a,0x52,0x52,
+       0x62,0x3c,0x40,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x30,0x0c,0x00,0x00,0x42,
+       0x42,0x42,0x42,0x42,0x42,0x46,0x3a,0x00,
+       0x00,0x08,0x08,0x10,0x00,0xfe,0x00,0x00,
+       0x0c,0x30,0x00,0x00,0x42,0x42,0x42,0x42,
+       0x42,0x42,0x46,0x3a,0x00,0x00,0x08,0x08,
+       0x10,0x00,0xfe,0x00,0x00,0x18,0x24,0x00,
+       0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x46,
+       0x3a,0x00,0x00,0x08,0x08,0x10,0x00,0xfe,
+       0x00,0x00,0x24,0x24,0x00,0x00,0x42,0x42,
+       0x42,0x42,0x42,0x42,0x46,0x3a,0x00,0x00,
+       0x08,0x08,0x10,0x00,0xfe,0x00,0x00,0x0c,
+       0x30,0x00,0x00,0x42,0x42,0x42,0x42,0x42,
+       0x26,0x1a,0x02,0x02,0x3c,0x08,0x08,0x10,
+       0x00,0xfe,0x00,0x00,0x00,0x00,0x20,0x20,
+       0x3c,0x22,0x22,0x22,0x24,0x28,0x30,0x20,
+       0x20,0x20,0x08,0x08,0x10,0x00,0xfe,0x00,
+       0x00,0x24,0x24,0x00,0x00,0x42,0x42,0x42,
+       0x42,0x42,0x26,0x1a,0x02,0x02,0x3c,0x08,
+       0x08,0x10,0x00,0xfe,0x00,0x00,0x00,0x00,
+       0x6e,0x90,0x90,0x90,0x9c,0x90,0x90,0x90,
+       0x90,0x6e,0x00,0x00,0x08,0x08,0x10,0x00,
+       0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,
+       0x92,0x92,0x9e,0x90,0x90,0x92,0x6c,0x00,
+       0x00};
+
+unsigned char * SF_defaultfont = &(myfont[0]);
+int SF_defaultfontsize = sizeof(myfont);
+
index 384d9da304eeb54ca0806dfcfeeb4d516fd8e36d..dc514c4e7f48b3ad6676cd2f802611420113cdd5 100644 (file)
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <unistd.h>\r
-\r
-#define STATIC static\r
-\r
-#include "sf_frotz.h"\r
-\r
-typedef struct {\r
-  void *left, *right;\r
-  char *value;\r
-  } ENTRY;\r
-\r
-\r
-extern SFONT *sf_VGA_SFONT;\r
-\r
-#define FRAMECOLOR 222275\r
-\r
-static char buffer[512];\r
-static char lastdir[FILENAME_MAX] = "";\r
-static char filename[FILENAME_MAX];\r
-static char pattern[64];\r
-static zword pushed = 0;\r
-static int wentry;\r
-\r
-static ulong *sbuffer = NULL;\r
-static int sbpitch;            // in longs\r
-static int ewidth, eheight;\r
-static int X,Y,W,H, xdlg,ydlg,wdlg,hdlg;\r
-\r
-#define HTEXT 18\r
-\r
-STATIC void cleanlist( ENTRY *t);\r
-STATIC void drawlist();\r
-STATIC ENTRY * dodir(\r
-       char *dirname, char *pattern, char *resdir, int size, int *ndirs, int *ntot);\r
-static int Numdirs, Numtot, First;\r
-static ENTRY *curdir = NULL, *selected;\r
-\r
-STATIC void updatelist()\r
-  {\r
-  if (curdir) cleanlist(curdir);\r
-  curdir = dodir(lastdir,pattern,lastdir,FILENAME_MAX,&Numdirs,&Numtot);\r
-  First = 0;\r
-  selected = NULL;\r
-  drawlist();\r
-  }\r
-\r
-STATIC void goright();\r
-STATIC void goleft();\r
-// assumes a / at end\r
-STATIC void goup()\r
-  {\r
-  char *p;\r
-  if (strlen(lastdir) < 2) return;\r
-  lastdir[strlen(lastdir)-1] = 0;\r
-  p = strrchr(lastdir,'/');\r
-  if (p){ p[1] = 0; updatelist();}\r
-  else strcat(lastdir,"/");\r
-  }\r
-\r
-typedef struct {\r
-  int x,y,w,h; // internal\r
-  zword (*click)(int,int);\r
-  ulong back;\r
-  int isbutton;\r
-  } BAREA;\r
-\r
-#define MAXBAREA 20\r
-static BAREA bareas[MAXBAREA];\r
-static int nbareas=0;\r
-static SF_textsetting *ts;\r
-\r
-#define BFRAME 2\r
-#define SPC 5\r
-\r
-#define WDLG (63*8)\r
-#define HDLG 208\r
-\r
-#define HCURSOR 8\r
-\r
-#define O_BLACK        0\r
-#define O_GRAY1        0x8a8a8a\r
-#define O_GRAY2        0xd6d6d6\r
-#define O_GRAY3        0xe2e2e2\r
-#define O_WHITE        0xf5f5f5\r
-\r
-STATIC void frame_upframe( int x, int y, int w, int h){\r
-  ulong v = O_WHITE;\r
-  sf_chline(x,y,v,w);\r
-  sf_cvline(x,y,v,--h);\r
-  v = O_BLACK;\r
-  sf_chline(x,y+h,v,w--);\r
-  sf_cvline(x+w--,y,v,h--);\r
-  x++; y++;\r
-  v = O_GRAY3;\r
-  sf_chline(x,y,v,w);\r
-  sf_cvline(x,y,v,--h);\r
-  v = O_GRAY1;\r
-  sf_chline(x,y+h,v,w--);\r
-  sf_cvline(x+w,y,v,h);\r
-  }\r
-\r
-STATIC void frame_downframe( int x, int y, int w, int h){\r
-  ulong v = O_BLACK;\r
-  sf_chline(x,y,v,w);\r
-  sf_cvline(x,y,v,--h);\r
-  v = O_WHITE;\r
-  sf_chline(x,y+h,v,w--);\r
-  sf_cvline(x+w--,y,v,h--);\r
-  x++; y++;\r
-  v = O_GRAY1;\r
-  sf_chline(x,y,v,w);\r
-  sf_cvline(x,y,v,--h);\r
-  v = O_GRAY3;\r
-  sf_chline(x,y+h,v,w--);\r
-  sf_cvline(x+w,y,v,h);\r
-  }\r
-\r
-// internal coords\r
-STATIC int addarea( int x, int y, int w, int h, zword (*click)(int,int))\r
-  {\r
-  BAREA *a = bareas+nbareas;\r
-  a->x = x; a->y = y; a->w = w; a->h = h; a->click = click;\r
-  a->back = O_GRAY2;\r
-  return nbareas++;\r
-  }\r
-\r
-STATIC void clarea( int n)\r
-  {\r
-  BAREA *a = bareas+n;\r
-  sf_fillrect(a->back,a->x,a->y,a->w,a->h);\r
-  }\r
-\r
-STATIC void writetext( ulong color, const char *s, int x, int y, int w, int center)\r
-  {\r
-  int ox,oy,ow,oh;\r
-//printf("W %p [%s]\n",s,s ? s : "??");\r
-  if (!s) return;\r
-  if (!s[0]) return;\r
-  sf_getclip(&ox,&oy,&ow,&oh);\r
-  sf_setclip(x,y,w,HTEXT);\r
-//printf("1\n");\r
-  if (center)\r
-       {\r
-       int wt = 8*strlen(s);\r
-       x += (w-wt)/2;\r
-       }\r
-//printf("2 ts %p\n",ts); fflush(stdout); if (ts < 1000){sf_flushdisplay(); getchar();}\r
-  ts->cx = x;\r
-  ts->cy = y;\r
-  ts->fore = color;\r
-//printf("3\n"); fflush(stdout);\r
-  while (*s) sf_writeglyph(ts->font->getglyph(ts->font,(*s++),1));\r
-//printf("4\n");\r
-  sf_setclip(ox,oy,ow,oh);\r
-//printf("5\n");\r
-  }\r
-\r
-STATIC int addbutton( int x, int y, int w, int h, char *text, zword (*click)(int,int))\r
-  {\r
-  int b = addarea(x,y,w,h,click);\r
-  bareas[b].isbutton = 1;\r
-  frame_upframe(x-2,y-2,w+4,h+4);\r
-  clarea(b);\r
-  if (text) writetext(0,text,x,y,w,1);\r
-  return b;\r
-  }\r
-\r
-static int B_up, B_ok, B_cancel;\r
-static int A_dir, A_filter, A_entry, A_list;\r
-\r
-#define BUTTW 60\r
-\r
-STATIC void showfilename( int pos)\r
-  {\r
-  BAREA *a = bareas+A_entry;\r
-  clarea(A_entry);\r
-  writetext(0,filename,a->x,a->y,a->w,0);\r
-  if (pos >= 0)\r
-    sf_cvline(a->x+8*pos,a->y,O_BLACK,HTEXT);\r
-  }\r
-\r
-STATIC void clicked( BAREA *a)\r
-  {\r
-  frame_downframe(a->x-2,a->y-2,a->w+4,a->h+4);\r
-  sf_flushdisplay();\r
-  sf_sleep(100);\r
-  frame_upframe(a->x-2,a->y-2,a->w+4,a->h+4);\r
-  sf_flushdisplay();\r
-  }\r
-\r
-STATIC zword checkmouse( int i0)\r
-  {\r
-  int x = mouse_x-1, y = mouse_y-1;\r
-  int i;\r
-  for (i=i0;i<nbareas;i++)\r
-    {\r
-    BAREA *a = bareas+i;\r
-    if (x > a->x && x < a->x+a->w && y > a->y && y < a->y+a->h)\r
-       {\r
-       if (a->click)\r
-               {\r
-               if (a->isbutton) clicked(a);\r
-               return a->click(x-a->x,y-a->y);\r
-               }\r
-       else return 0;\r
-       }\r
-    }\r
-  return 0;\r
-  }\r
-\r
-STATIC zword Zup( int x, int y)\r
-  {\r
-  goup();\r
-  return 0;\r
-  }\r
-\r
-STATIC zword Zok( int x, int y)\r
-  {\r
-  return ZC_RETURN;\r
-  }\r
-\r
-STATIC zword Zcanc( int x, int y)\r
-  {\r
-  return ZC_ESCAPE;\r
-  }\r
-\r
-STATIC zword Zselect( int x, int y);\r
-STATIC zword yesnoover( int xc, int yc);\r
-STATIC zword Zentry( int x, int y);\r
-\r
-STATIC zword inputkey()\r
-  {\r
-  zword c = sf_read_key(0,0,1);\r
-  if (c == ZC_SINGLE_CLICK)\r
-    {\r
-    switch (mouse_button)\r
-       {\r
-       case 4: c = ZC_ARROW_LEFT; break;\r
-       case 5: c = ZC_ARROW_RIGHT; break;\r
-       case 1: break;\r
-       default: c = 0; break;\r
-       }\r
-    }\r
-//    if (os_read_mouse() != 1) c = 0;\r
-  return c;\r
-  }\r
-\r
-int (*sf_sysdialog)( bool existing, const char *def, const char *filt, const char *tit, char **res) = NULL;\r
-\r
-STATIC int myosdialog( bool existing, const char *def, const char *filt, const char *tit, char **res, ulong *sbuf, int sbp, int ew, int eh, int isfull)\r
-  {\r
-  char *pp; ulong *saved; int y0, y1, y2, x1;\r
-  zword c = 0;\r
-\r
-       // allow system-specific dialog if not fullscreen\r
-  if (isfull == 0) if (sf_sysdialog)\r
-       return sf_sysdialog(existing,def,filt,tit,res);\r
-\r
-  ts = sf_curtextsetting();\r
-  if (!ts) return SF_NOTIMP;\r
-\r
-//printf("0 ts %p (%p)\n",ts,&ts);\r
-\r
-  if (!def) def = "";\r
-  strcpy(filename,def);\r
-  pp = strrchr(filename,'/');\r
-  if (pp)\r
-       {\r
-       *pp = 0;\r
-       strcpy(lastdir,filename);\r
-       strcpy(filename,pp+1);\r
-       }\r
-\r
-  if (!filt) filt = "*|All files";\r
-\r
-  if (!lastdir[0]) strcpy(lastdir,"./");\r
-\r
-  strcpy(buffer,filt);\r
-  pp = strchr(buffer,'|'); if (pp) *pp = 0;\r
-  strcpy(pattern,buffer);\r
-\r
-  ewidth = ew;\r
-  eheight = eh;\r
-  sbuffer = sbuf;\r
-  sbpitch = sbp;\r
-\r
-  wdlg = WDLG;\r
-  hdlg = HDLG;\r
-\r
-  nbareas = 0;\r
-\r
-  W = WDLG+4*BFRAME+2*SPC;\r
-  H = HDLG+4*BFRAME+6*SPC+6*BFRAME+3*(HTEXT+2)+HCURSOR+HTEXT;\r
-\r
-  if (W > ew) return SF_NOTIMP;\r
-  if (H > eh) return SF_NOTIMP;\r
-\r
-  X = (ew-W)/2;\r
-  Y = (eh-H)/2;\r
-\r
-       // internal!!\r
-  xdlg = X+SPC+2*BFRAME;\r
-  ydlg = Y+2*SPC+4*BFRAME+HTEXT+HTEXT;\r
-\r
-  wentry = wdlg - BUTTW - SPC - 2*BFRAME;\r
-\r
-  saved = sf_savearea(X,Y,W,H);\r
-  if (!saved) return SF_NOTIMP;\r
-\r
-//printf("saved: %p %d %d %d %d\n",saved,saved[0],saved[1],saved[2],saved[3]);\r
-  sf_pushtextsettings();\r
-  ts->font = sf_VGA_SFONT;\r
-  ts->style = 0;\r
-  ts->oh = 0;\r
-  ts->fore = 0;\r
-  ts->backTransparent = 1;\r
-\r
-  sf_fillrect(O_GRAY2,X,Y,W,H);\r
-//  frame_upframe(X,Y,W,H);\r
-  sf_rect(FRAMECOLOR,X,Y,W,H);\r
-  sf_rect(FRAMECOLOR,X+1,Y+1,W-2,H-2);\r
-  sf_fillrect(FRAMECOLOR,X,Y+2,W,HTEXT);\r
-  if (tit) writetext(O_WHITE,tit,X+2+SPC,Y+2,W-4,0);\r
-  A_list = addarea(xdlg,ydlg,wdlg,hdlg,Zselect);\r
-  bareas[A_list].back = O_WHITE;\r
-  clarea(A_list);\r
-  frame_downframe(xdlg-2,ydlg-2,wdlg+4,hdlg+4);\r
-\r
-  y0 = Y+SPC+2*BFRAME+HTEXT;\r
-  y2 = Y+H-SPC-2*BFRAME-HTEXT;\r
-  y1 = y2-SPC-HTEXT-2*BFRAME;\r
-  x1 = xdlg+wentry+2*BFRAME+SPC;\r
-\r
-  A_dir = addarea(xdlg,y0,wentry,HTEXT,NULL);\r
-  A_entry = addarea(xdlg,y1,wentry,HTEXT,Zentry);\r
-  bareas[A_entry].back = O_WHITE;\r
-  clarea(A_entry);\r
-  frame_downframe(xdlg-2,y1-2,wentry+4,HTEXT+4);\r
-  B_up = addbutton(x1,y0,BUTTW,HTEXT,"^up^",Zup);\r
-  A_filter = addarea(xdlg,y2,wentry,HTEXT,NULL);\r
-  strcpy(buffer,"Filter: ");\r
-  strcat(buffer,filt);\r
-  writetext(0,buffer,xdlg,y2,wentry,0);\r
-  B_cancel = addbutton(x1,y2,BUTTW,HTEXT,"Cancel",Zcanc);\r
-  B_ok = addbutton(x1,y1,BUTTW,HTEXT,"OK",Zok);\r
-\r
-  showfilename(-1);\r
-  updatelist();\r
-\r
-  for (;;)\r
-    {\r
-    if (pushed) { c = pushed; pushed = 0;}\r
-    else c = inputkey();\r
-    if (c == ZC_SINGLE_CLICK) c = checkmouse(0);\r
-    if (c == VK_INS) c = Zentry(0,-1);\r
-    if (c == ZC_ARROW_LEFT) goleft();\r
-    if (c == ZC_ARROW_RIGHT) goright();\r
-    if (c == ZC_ESCAPE) break;\r
-    if (c == ZC_RETURN)\r
-       {\r
-       strcpy(buffer,lastdir);\r
-       strcat(buffer,filename);\r
-       *res = buffer;\r
-       if ((existing==0) && (access(buffer,F_OK)==0))\r
-               c = yesnoover(xdlg+wdlg/2,ydlg+hdlg/2);\r
-       if (c == ZC_RETURN) break;\r
-       }\r
-    }\r
-\r
-  sf_poptextsettings();\r
-\r
-  cleanlist(curdir); curdir = NULL;\r
-\r
-//printf("2saved: %p %d %d %d %d\n",saved,saved[0],saved[1],saved[2],saved[3]);\r
-  sf_restoreareaandfree(saved);\r
-\r
-  if (c == ZC_ESCAPE) return -1;\r
-\r
-  if (c == ZC_RETURN)\r
-       {\r
-       strcpy(buffer,lastdir);\r
-       strcat(buffer,filename);\r
-       *res = buffer;\r
-       return 0;\r
-       }\r
-\r
-  return SF_NOTIMP;\r
-  }\r
-\r
-void sf_setdialog(void)\r
-{\r
-  sf_osdialog = myosdialog;\r
-}\r
-\r
-///////////////////////////////////\r
-\r
-#include <stdlib.h>\r
-#include <stdarg.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#ifdef WIN32\r
-#define strcasecmp stricmp\r
-#else\r
-#include <strings.h>\r
-#endif\r
-#include <unistd.h>\r
-#include <dirent.h>\r
-//#include <fnmatch.h>\r
-#include <sys/stat.h>\r
-\r
-// simplified fnmatch - only allows a single * at beginning\r
-STATIC int myfnmatch( const char *pattern, const char *p, int dummy)\r
-  {\r
-  int lpat, lp;\r
-  if (!pattern) return -1;\r
-  if (!p) return -1;\r
-  if (pattern[0] != '*') return strcmp(pattern,p);\r
-  lpat = strlen(pattern);\r
-  if (lpat == 1) return 0;     // * matches anything\r
-  lpat--; pattern++;\r
-  lp = strlen(p);\r
-  if (lp < lpat) return 1;     // too short\r
-  return strcmp(pattern,p+lp-lpat);\r
-  }\r
-\r
-STATIC void cleanlist( ENTRY *t)\r
-  {\r
-  while (t)\r
-       {\r
-       ENTRY *n = t->right;\r
-       if (t->value) free(t->value);\r
-       free(t);\r
-       t = n;\r
-       }\r
-  }\r
-\r
-STATIC ENTRY * newentry( char *s)\r
-  {\r
-  ENTRY *r = calloc(1,sizeof(ENTRY));\r
-\r
-  if (r){\r
-       r->value = strdup(s);\r
-       if (!r->value){ free(r); return NULL;}\r
-       }\r
-  return r;\r
-  }\r
-\r
-STATIC void addentry( char *s, ENTRY **ae)\r
-  {\r
-  ENTRY *t = *ae;\r
-  if (!t)\r
-       {\r
-       *ae = newentry(s);\r
-       return;\r
-       }\r
-  for (;;)\r
-       {\r
-       int k = strcasecmp(s,t->value);\r
-       if (!k) return;\r
-       if (k > 0)\r
-               {\r
-               if (t->right) t = t->right;\r
-               else\r
-                       {\r
-                       t->right = newentry(s);\r
-                       return;\r
-                       }\r
-               }\r
-       else\r
-               {\r
-               if (t->left) t = t->left;\r
-               else\r
-                       {\r
-                       t->left = newentry(s);\r
-                       return;\r
-                       }\r
-               }\r
-       }\r
-  }\r
-\r
-STATIC char *resolvedir( char *dir, char *res, int size)\r
-  {\r
-  char cwd[FILENAME_MAX], *p; int i;\r
-  if (!getcwd(cwd,FILENAME_MAX)) return NULL;\r
-  if (chdir(dir)) return NULL;\r
-  p = getcwd(res,size);\r
-  for (i=0;p[i];i++) if (p[i]=='\\') p[i] = '/';\r
-  chdir(cwd);\r
-  if (p)\r
-       {\r
-       int n = strlen(p);\r
-       if (n) if (p[n-1] != '/') { p[n] = '/'; p[n+1] = 0;}\r
-       }\r
-  return p;\r
-  }\r
-\r
-STATIC ENTRY * dodir(\r
-       char *dirname, char *pattern, char *resdir, int size, int *ndirs, int *ntot)\r
-  {\r
-  DIR *dir;\r
-  ENTRY *dirs = NULL;\r
-  ENTRY *files = NULL, *res = NULL;\r
-  struct dirent *d;\r
-  char *p, *resdend;\r
-  struct stat fst;\r
-  int n;\r
-\r
-  void exhaust( ENTRY *e)\r
-    {\r
-    if (!e) return;\r
-    exhaust(e->left);\r
-    e->left = res;\r
-    res = e;\r
-    n++;\r
-    exhaust(e->right);\r
-    }\r
-\r
-//printf("\ndodir\n");\r
-  if (!resolvedir(dirname,resdir,size)) return NULL;\r
-  resdend = resdir+strlen(resdir);\r
-\r
-//printf("[%s]\n",resdir);\r
-       // MinGW opendir() does not like the final slash\r
-#ifdef WIN32\r
-  n = strlen(resdir);\r
-  if (n > 2 && (resdir[n-2] != ':'))\r
-       resdir[n-1] = 0;\r
-  dir = opendir(resdir);\r
-  resdir[n-1] = '/';\r
-#else\r
-  dir = opendir(resdir);\r
-#endif\r
-  if (!dir) return NULL;\r
-\r
-//printf("opened [%s]\n",resdir);\r
-  for (;;)\r
-    {\r
-    d = readdir(dir);\r
-    if (!d) break;\r
-    p = d->d_name;\r
-    if (strcmp(p,".")==0) continue;\r
-    if (strcmp(p,"..")==0) continue;\r
-    strcpy(resdend,p);\r
-//printf("-%s\n",resdir);\r
-    if (stat(resdir,&fst)) continue;\r
-//printf("--mode %x\n",fst.st_mode);\r
-    if (S_ISDIR(fst.st_mode))\r
-       addentry(p,&dirs);\r
-    else\r
-       {\r
-//printf("--fnmatch: %d\n",fnmatch(pattern,p,0));\r
-       if (myfnmatch(pattern,p,0)==0) addentry(p,&files);\r
-       }\r
-    }\r
-\r
-  closedir(dir);\r
-  *resdend = 0;\r
-\r
-  n = 0;\r
-  exhaust(dirs);\r
-  *ndirs = n;\r
-  exhaust(files);\r
-  *ntot = n;\r
-\r
-  if (res)\r
-    while (res->left)\r
-       {\r
-       ((ENTRY *)(res->left))->right = res;\r
-       res = res->left;\r
-       }\r
-\r
-  return res;\r
-  }\r
-\r
-\r
-//////////////////////////////////////////////\r
-// white,black,gray,yellow\r
-static ulong bcolors[4] = {0xfcfcfc,0,0xa0a0a0,0xa0d0e0};\r
-\r
-static unsigned char folderbmp[] = {\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,1,1,1,1,1,1,\r
-       0,0,0,0,0,0,0,0,\r
-       0,1,3,3,3,3,3,3,\r
-       1,1,1,1,1,1,0,0,\r
-       0,1,3,3,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,1,3,3,3,3,3,3,\r
-       3,1,1,1,1,1,1,0,\r
-       0,1,3,3,1,1,1,1,\r
-       1,3,3,3,3,3,1,0,\r
-       0,1,3,1,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,1,3,1,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,1,3,1,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,1,3,1,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,1,3,1,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,1,3,1,3,3,3,3,\r
-       3,3,3,3,3,3,1,0,\r
-       0,0,1,1,1,1,1,1,\r
-       1,1,1,1,1,1,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0};\r
-\r
-\r
-static unsigned char docbmp[] = {\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,1,1,1,1,1,1,\r
-       1,1,1,1,1,1,0,0,\r
-       0,1,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,1,0,\r
-       0,1,0,2,2,2,2,2,\r
-       2,2,2,2,2,0,1,0,\r
-       0,1,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,1,0,\r
-       0,1,0,2,2,2,2,2,\r
-       2,2,2,2,2,0,1,0,\r
-       0,1,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,1,0,\r
-       0,1,0,2,2,2,2,2,\r
-       2,2,2,2,2,0,1,0,\r
-       0,1,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,1,0,\r
-       0,1,0,2,2,2,2,2,\r
-       2,2,2,2,2,0,1,0,\r
-       0,1,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,1,0,\r
-       0,1,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,1,0,\r
-       0,0,1,1,1,1,1,1,\r
-       1,1,1,1,1,1,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0,\r
-       0,0,0,0,0,0,0,0};\r
-\r
-////////////////////////////////\r
-\r
-STATIC void drawit( int x, int y, ENTRY *e, int w, int issub)\r
-  {\r
-  int i, j, n, color;\r
-  unsigned char *bmp;\r
-  char *s = e->value;\r
-  bmp = (issub ? folderbmp : docbmp);\r
-  for (i=0;i<16;i++) for (j=0;j<16;j++) sf_wpixel(x+j,y+i,bcolors[*bmp++]);\r
-  x += 17;\r
-  w -= 17;\r
-  n = w/8;\r
-  if (n < 1) return;\r
-  if (strlen(s) > n)\r
-       {\r
-       strcpy(buffer,s);\r
-       buffer[n] = 0;\r
-       buffer[n-1] = '>';\r
-       s = buffer;\r
-       }\r
-  if (e == selected)\r
-       {\r
-       color = O_WHITE;\r
-       sf_fillrect(0,x,y,w,16);\r
-       }\r
-  else\r
-       color = O_BLACK;\r
-  writetext(color,s,x,y,w,0);\r
-  }\r
-\r
-static int Nrows, Ncols, Ewid, Fh;\r
-\r
-STATIC void drawnames( int x, int y, int w, int h, ENTRY *files, int first, int nsub, int ntot, int ewid)\r
-  {\r
-  int i;\r
-\r
-  Fh = 16;\r
-  Ewid = ewid;\r
-  Ncols = w/ewid;\r
-  Nrows = h/Fh;\r
-\r
-  sf_fillrect(O_WHITE,x,y,w,h);\r
-  if (!files) return;\r
-  if (first < 0) return;\r
-  if (nsub > ntot) nsub = ntot;\r
-  while (first > 0)\r
-       {\r
-       files = files->right;\r
-       if (!files) return;\r
-       nsub--;\r
-       ntot--;\r
-       first--;\r
-       }\r
-  if (ntot <= 0) return;\r
-  if (Ncols < 1) return;\r
-  if (Nrows < 1) return;\r
-  if (Nrows*Ncols < ntot) ntot = Nrows*Ncols;\r
-  for (i=0;i<ntot;i++)\r
-       {\r
-       drawit(x+ewid*(i/Nrows),y+Fh*(i % Nrows),files,ewid,i < nsub);\r
-       files = files->right;\r
-       }\r
-  }\r
-\r
-STATIC void drawlist()\r
-  {\r
-  BAREA *a = bareas+A_list, *b = bareas+A_dir;\r
-\r
-  clarea(A_dir);\r
-  writetext(0,lastdir,b->x,b->y,b->w,0);\r
-  drawnames(a->x,a->y,a->w,a->h,curdir,First,Numdirs,Numtot,21*8);\r
-\r
-  }\r
-\r
-STATIC void goright()\r
-  {\r
-  if (First+Nrows*Ncols > Numtot) return;\r
-  First += Nrows;\r
-  drawlist();\r
-  }\r
-\r
-STATIC void goleft()\r
-  {\r
-  if (!First) return;\r
-  First -= Nrows;\r
-  drawlist();\r
-  }\r
-\r
-STATIC ENTRY *filesat( int n){\r
-  ENTRY *e = curdir;\r
-  while (n--)\r
-       {\r
-       if (e) e = e->right;\r
-       }\r
-  return e;\r
-  }\r
-\r
-STATIC zword Zselect( int x, int y)\r
-  {\r
-  int n;\r
-  x /= Ewid;\r
-  y /= Fh;\r
-  n = First + y + x*Nrows;\r
-  if (n >= Numtot)\r
-       {\r
-       if (selected)\r
-               {\r
-               selected = NULL;\r
-               drawlist();\r
-               }\r
-       return 0;\r
-       }\r
-  if (n < Numdirs)\r
-       {\r
-       ENTRY *e = filesat(n);\r
-       if (!e) return 0;\r
-       strcat(lastdir,e->value);\r
-       updatelist();\r
-       return 0;\r
-       }\r
-  selected = curdir;\r
-  while (n--) selected = selected->right;\r
-  strcpy(filename,selected->value);\r
-  showfilename(-1);\r
-  drawlist();\r
-  return 0;\r
-  }\r
-\r
-extern void sf_videodata( ulong **sb, int *sp, int *ew, int *eh);\r
-zword sf_yesnooverlay( int xc, int yc, char *t, int saverest)\r
-  {\r
-  zword c = ZC_RETURN;\r
-  int nsav = nbareas;\r
-  ulong *saved = NULL;\r
-  int hx = BUTTW+3*SPC, hy = HTEXT+2*SPC, heff;\r
-\r
-  heff = 8*strlen(t);\r
-  if (heff > 2*hx) hx = (heff+3)/2;\r
-  if (saverest)\r
-       {\r
-       ts = sf_curtextsetting();\r
-       if (!ts) return ZC_ESCAPE;\r
-       saved = sf_savearea(xc-hx-2,yc-hy-2,2*hx+4,2*hy+4);\r
-       if (!saved) return ZC_ESCAPE;\r
-       sf_pushtextsettings();\r
-       ts->font = sf_VGA_SFONT;\r
-       ts->style = 0;\r
-       ts->oh = 0;\r
-       ts->fore = 0;\r
-       ts->backTransparent = 1;\r
-       sf_videodata(&sbuffer, &sbpitch, &ewidth, &eheight);\r
-       }\r
-\r
-  sf_fillrect(FRAMECOLOR,xc-hx-2,yc-hy-2,2*hx+4,2*hy+4);\r
-  sf_fillrect(O_WHITE,xc-hx,yc-hy,2*hx,2*hy);\r
-  writetext(O_BLACK,t,xc-hx,yc-SPC-HTEXT,2*hx,1);\r
-  addbutton(xc-SPC-BUTTW,yc+SPC,BUTTW,HTEXT,"Yes",Zok);\r
-  addbutton(xc+SPC,yc+SPC,BUTTW,HTEXT,"No",Zcanc);\r
-  for (;;)\r
-    {\r
-    c = inputkey();\r
-    if (c == 'n' || c == 'N') c = ZC_ESCAPE;\r
-    if (c == 'y' || c == 'Y') c = ZC_RETURN;\r
-    if (c == ZC_SINGLE_CLICK) c = checkmouse(nsav);\r
-    if (c == ZC_ESCAPE) break;\r
-    if (c == ZC_RETURN) break;\r
-    }\r
-\r
-  if (saved)\r
-       {\r
-       sf_restoreareaandfree(saved);\r
-       sf_poptextsettings();\r
-       }\r
-\r
-  nbareas = nsav;\r
-  return c;\r
-  }\r
-\r
-STATIC zword yesnoover( int xc, int yc)\r
-  {\r
-  zword c;\r
-\r
-  c = sf_yesnooverlay(xc,yc,"Overwrite file?",0);\r
-\r
-  drawlist();\r
-  return c;\r
-  }\r
-\r
-// this is needed for overlapping source and dest in Zentry\r
-// (lib does not guarantee correct behaviour in that case)\r
-static void mystrcpy( char *d, const char *s)\r
-  {\r
-  while ((*d++ = *s++));\r
-  }\r
-\r
-STATIC zword Zentry( int x, int y)\r
-  {\r
-  static int pos = 10000;\r
-  int i,n,nmax; zword c;\r
-\r
-  nmax = wentry/8;\r
-  if (nmax >= FILENAME_MAX) nmax = FILENAME_MAX-1;\r
-  n = strlen(filename);\r
-  if (n > nmax) { n = nmax; filename[n] = 0;}\r
-  if (y >= 0)\r
-    {\r
-    pos = x/4-1; if (pos < 0) pos = 0;\r
-    pos /= 2;\r
-    }\r
-  if (pos > n) pos = n;\r
-  showfilename(pos);\r
-  for (;;)\r
-    {\r
-    c = inputkey();\r
-    if (c == ZC_SINGLE_CLICK)\r
-       {\r
-       pushed = c;\r
-       c = 0;\r
-       break;\r
-       }\r
-    if (c == ZC_ESCAPE || c == VK_INS) { c = 0; break; }\r
-    if (c == ZC_RETURN) break;\r
-    if (c == ZC_ARROW_LEFT)\r
-       {\r
-       if (pos){ pos--; showfilename(pos); }\r
-       continue;\r
-       }\r
-    if (c == ZC_ARROW_RIGHT)\r
-       {\r
-       if (pos < n){ pos++; showfilename(pos); }\r
-       continue;\r
-       }\r
-    if (c == ZC_BACKSPACE)\r
-       {\r
-       if (pos)\r
-               {\r
-                       // needs mystrcpy() because overlapping src-dst\r
-               if (pos < n) mystrcpy(filename+pos-1,filename+pos);\r
-               n--;\r
-               filename[n] = 0;\r
-               pos--;\r
-               showfilename(pos);\r
-               }\r
-       continue;\r
-       }\r
-    if ((c >= 32 && c < 127) || (c >= 160 && c < 256))\r
-       {\r
-       if (n >= nmax) continue;\r
-       if (n > pos)\r
-         for (i=n;i>pos;i--) filename[i] = filename[i-1];\r
-       filename[pos] = c;\r
-       n++;\r
-       filename[n] = 0;\r
-       pos++;\r
-       showfilename(pos);\r
-       }\r
-    }\r
-  showfilename(-1);\r
-  return c;\r
-  }\r
-\r
-\r
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#define STATIC static
+
+#include "sf_frotz.h"
+
+typedef struct {
+  void *left, *right;
+  char *value;
+  } ENTRY;
+
+
+extern SFONT *sf_VGA_SFONT;
+
+#define FRAMECOLOR 222275
+
+static char buffer[512];
+static char lastdir[FILENAME_MAX] = "";
+static char filename[FILENAME_MAX];
+static char pattern[64];
+static zword pushed = 0;
+static int wentry;
+
+static ulong *sbuffer = NULL;
+static int sbpitch;            // in longs
+static int ewidth, eheight;
+static int X,Y,W,H, xdlg,ydlg,wdlg,hdlg;
+
+#define HTEXT 18
+
+STATIC void cleanlist( ENTRY *t);
+STATIC void drawlist();
+STATIC ENTRY * dodir(
+       char *dirname, char *pattern, char *resdir, int size, int *ndirs, int *ntot);
+static int Numdirs, Numtot, First;
+static ENTRY *curdir = NULL, *selected;
+
+STATIC void updatelist()
+  {
+  if (curdir) cleanlist(curdir);
+  curdir = dodir(lastdir,pattern,lastdir,FILENAME_MAX,&Numdirs,&Numtot);
+  First = 0;
+  selected = NULL;
+  drawlist();
+  }
+
+STATIC void goright();
+STATIC void goleft();
+// assumes a / at end
+STATIC void goup()
+  {
+  char *p;
+  if (strlen(lastdir) < 2) return;
+  lastdir[strlen(lastdir)-1] = 0;
+  p = strrchr(lastdir,'/');
+  if (p){ p[1] = 0; updatelist();}
+  else strcat(lastdir,"/");
+  }
+
+typedef struct {
+  int x,y,w,h; // internal
+  zword (*click)(int,int);
+  ulong back;
+  int isbutton;
+  } BAREA;
+
+#define MAXBAREA 20
+static BAREA bareas[MAXBAREA];
+static int nbareas=0;
+static SF_textsetting *ts;
+
+#define BFRAME 2
+#define SPC 5
+
+#define WDLG (63*8)
+#define HDLG 208
+
+#define HCURSOR 8
+
+#define O_BLACK        0
+#define O_GRAY1        0x8a8a8a
+#define O_GRAY2        0xd6d6d6
+#define O_GRAY3        0xe2e2e2
+#define O_WHITE        0xf5f5f5
+
+STATIC void frame_upframe( int x, int y, int w, int h){
+  ulong v = O_WHITE;
+  sf_chline(x,y,v,w);
+  sf_cvline(x,y,v,--h);
+  v = O_BLACK;
+  sf_chline(x,y+h,v,w--);
+  sf_cvline(x+w--,y,v,h--);
+  x++; y++;
+  v = O_GRAY3;
+  sf_chline(x,y,v,w);
+  sf_cvline(x,y,v,--h);
+  v = O_GRAY1;
+  sf_chline(x,y+h,v,w--);
+  sf_cvline(x+w,y,v,h);
+  }
+
+STATIC void frame_downframe( int x, int y, int w, int h){
+  ulong v = O_BLACK;
+  sf_chline(x,y,v,w);
+  sf_cvline(x,y,v,--h);
+  v = O_WHITE;
+  sf_chline(x,y+h,v,w--);
+  sf_cvline(x+w--,y,v,h--);
+  x++; y++;
+  v = O_GRAY1;
+  sf_chline(x,y,v,w);
+  sf_cvline(x,y,v,--h);
+  v = O_GRAY3;
+  sf_chline(x,y+h,v,w--);
+  sf_cvline(x+w,y,v,h);
+  }
+
+// internal coords
+STATIC int addarea( int x, int y, int w, int h, zword (*click)(int,int))
+  {
+  BAREA *a = bareas+nbareas;
+  a->x = x; a->y = y; a->w = w; a->h = h; a->click = click;
+  a->back = O_GRAY2;
+  return nbareas++;
+  }
+
+STATIC void clarea( int n)
+  {
+  BAREA *a = bareas+n;
+  sf_fillrect(a->back,a->x,a->y,a->w,a->h);
+  }
+
+STATIC void writetext( ulong color, const char *s, int x, int y, int w, int center)
+  {
+  int ox,oy,ow,oh;
+//printf("W %p [%s]\n",s,s ? s : "??");
+  if (!s) return;
+  if (!s[0]) return;
+  sf_getclip(&ox,&oy,&ow,&oh);
+  sf_setclip(x,y,w,HTEXT);
+//printf("1\n");
+  if (center)
+       {
+       int wt = 8*strlen(s);
+       x += (w-wt)/2;
+       }
+//printf("2 ts %p\n",ts); fflush(stdout); if (ts < 1000){sf_flushdisplay(); getchar();}
+  ts->cx = x;
+  ts->cy = y;
+  ts->fore = color;
+//printf("3\n"); fflush(stdout);
+  while (*s) sf_writeglyph(ts->font->getglyph(ts->font,(*s++),1));
+//printf("4\n");
+  sf_setclip(ox,oy,ow,oh);
+//printf("5\n");
+  }
+
+STATIC int addbutton( int x, int y, int w, int h, char *text, zword (*click)(int,int))
+  {
+  int b = addarea(x,y,w,h,click);
+  bareas[b].isbutton = 1;
+  frame_upframe(x-2,y-2,w+4,h+4);
+  clarea(b);
+  if (text) writetext(0,text,x,y,w,1);
+  return b;
+  }
+
+static int B_up, B_ok, B_cancel;
+static int A_dir, A_filter, A_entry, A_list;
+
+#define BUTTW 60
+
+STATIC void showfilename( int pos)
+  {
+  BAREA *a = bareas+A_entry;
+  clarea(A_entry);
+  writetext(0,filename,a->x,a->y,a->w,0);
+  if (pos >= 0)
+    sf_cvline(a->x+8*pos,a->y,O_BLACK,HTEXT);
+  }
+
+STATIC void clicked( BAREA *a)
+  {
+  frame_downframe(a->x-2,a->y-2,a->w+4,a->h+4);
+  sf_flushdisplay();
+  sf_sleep(100);
+  frame_upframe(a->x-2,a->y-2,a->w+4,a->h+4);
+  sf_flushdisplay();
+  }
+
+STATIC zword checkmouse( int i0)
+  {
+  int x = mouse_x-1, y = mouse_y-1;
+  int i;
+  for (i=i0;i<nbareas;i++)
+    {
+    BAREA *a = bareas+i;
+    if (x > a->x && x < a->x+a->w && y > a->y && y < a->y+a->h)
+       {
+       if (a->click)
+               {
+               if (a->isbutton) clicked(a);
+               return a->click(x-a->x,y-a->y);
+               }
+       else return 0;
+       }
+    }
+  return 0;
+  }
+
+STATIC zword Zup( int x, int y)
+  {
+  goup();
+  return 0;
+  }
+
+STATIC zword Zok( int x, int y)
+  {
+  return ZC_RETURN;
+  }
+
+STATIC zword Zcanc( int x, int y)
+  {
+  return ZC_ESCAPE;
+  }
+
+STATIC zword Zselect( int x, int y);
+STATIC zword yesnoover( int xc, int yc);
+STATIC zword Zentry( int x, int y);
+
+STATIC zword inputkey()
+  {
+  zword c = sf_read_key(0,0,1);
+  if (c == ZC_SINGLE_CLICK)
+    {
+    switch (mouse_button)
+       {
+       case 4: c = ZC_ARROW_LEFT; break;
+       case 5: c = ZC_ARROW_RIGHT; break;
+       case 1: break;
+       default: c = 0; break;
+       }
+    }
+//    if (os_read_mouse() != 1) c = 0;
+  return c;
+  }
+
+int (*sf_sysdialog)( bool existing, const char *def, const char *filt, const char *tit, char **res) = NULL;
+
+STATIC int myosdialog( bool existing, const char *def, const char *filt, const char *tit, char **res, ulong *sbuf, int sbp, int ew, int eh, int isfull)
+  {
+  char *pp; ulong *saved; int y0, y1, y2, x1;
+  zword c = 0;
+
+       // allow system-specific dialog if not fullscreen
+  if (isfull == 0) if (sf_sysdialog)
+       return sf_sysdialog(existing,def,filt,tit,res);
+
+  ts = sf_curtextsetting();
+  if (!ts) return SF_NOTIMP;
+
+//printf("0 ts %p (%p)\n",ts,&ts);
+
+  if (!def) def = "";
+  strcpy(filename,def);
+  pp = strrchr(filename,'/');
+  if (pp)
+       {
+       *pp = 0;
+       strcpy(lastdir,filename);
+       strcpy(filename,pp+1);
+       }
+
+  if (!filt) filt = "*|All files";
+
+  if (!lastdir[0]) strcpy(lastdir,"./");
+
+  strcpy(buffer,filt);
+  pp = strchr(buffer,'|'); if (pp) *pp = 0;
+  strcpy(pattern,buffer);
+
+  ewidth = ew;
+  eheight = eh;
+  sbuffer = sbuf;
+  sbpitch = sbp;
+
+  wdlg = WDLG;
+  hdlg = HDLG;
+
+  nbareas = 0;
+
+  W = WDLG+4*BFRAME+2*SPC;
+  H = HDLG+4*BFRAME+6*SPC+6*BFRAME+3*(HTEXT+2)+HCURSOR+HTEXT;
+
+  if (W > ew) return SF_NOTIMP;
+  if (H > eh) return SF_NOTIMP;
+
+  X = (ew-W)/2;
+  Y = (eh-H)/2;
+
+       // internal!!
+  xdlg = X+SPC+2*BFRAME;
+  ydlg = Y+2*SPC+4*BFRAME+HTEXT+HTEXT;
+
+  wentry = wdlg - BUTTW - SPC - 2*BFRAME;
+
+  saved = sf_savearea(X,Y,W,H);
+  if (!saved) return SF_NOTIMP;
+
+//printf("saved: %p %d %d %d %d\n",saved,saved[0],saved[1],saved[2],saved[3]);
+  sf_pushtextsettings();
+  ts->font = sf_VGA_SFONT;
+  ts->style = 0;
+  ts->oh = 0;
+  ts->fore = 0;
+  ts->backTransparent = 1;
+
+  sf_fillrect(O_GRAY2,X,Y,W,H);
+//  frame_upframe(X,Y,W,H);
+  sf_rect(FRAMECOLOR,X,Y,W,H);
+  sf_rect(FRAMECOLOR,X+1,Y+1,W-2,H-2);
+  sf_fillrect(FRAMECOLOR,X,Y+2,W,HTEXT);
+  if (tit) writetext(O_WHITE,tit,X+2+SPC,Y+2,W-4,0);
+  A_list = addarea(xdlg,ydlg,wdlg,hdlg,Zselect);
+  bareas[A_list].back = O_WHITE;
+  clarea(A_list);
+  frame_downframe(xdlg-2,ydlg-2,wdlg+4,hdlg+4);
+
+  y0 = Y+SPC+2*BFRAME+HTEXT;
+  y2 = Y+H-SPC-2*BFRAME-HTEXT;
+  y1 = y2-SPC-HTEXT-2*BFRAME;
+  x1 = xdlg+wentry+2*BFRAME+SPC;
+
+  A_dir = addarea(xdlg,y0,wentry,HTEXT,NULL);
+  A_entry = addarea(xdlg,y1,wentry,HTEXT,Zentry);
+  bareas[A_entry].back = O_WHITE;
+  clarea(A_entry);
+  frame_downframe(xdlg-2,y1-2,wentry+4,HTEXT+4);
+  B_up = addbutton(x1,y0,BUTTW,HTEXT,"^up^",Zup);
+  A_filter = addarea(xdlg,y2,wentry,HTEXT,NULL);
+  strcpy(buffer,"Filter: ");
+  strcat(buffer,filt);
+  writetext(0,buffer,xdlg,y2,wentry,0);
+  B_cancel = addbutton(x1,y2,BUTTW,HTEXT,"Cancel",Zcanc);
+  B_ok = addbutton(x1,y1,BUTTW,HTEXT,"OK",Zok);
+
+  showfilename(-1);
+  updatelist();
+
+  for (;;)
+    {
+    if (pushed) { c = pushed; pushed = 0;}
+    else c = inputkey();
+    if (c == ZC_SINGLE_CLICK) c = checkmouse(0);
+    if (c == VK_INS) c = Zentry(0,-1);
+    if (c == ZC_ARROW_LEFT) goleft();
+    if (c == ZC_ARROW_RIGHT) goright();
+    if (c == ZC_ESCAPE) break;
+    if (c == ZC_RETURN)
+       {
+       strcpy(buffer,lastdir);
+       strcat(buffer,filename);
+       *res = buffer;
+       if ((existing==0) && (access(buffer,F_OK)==0))
+               c = yesnoover(xdlg+wdlg/2,ydlg+hdlg/2);
+       if (c == ZC_RETURN) break;
+       }
+    }
+
+  sf_poptextsettings();
+
+  cleanlist(curdir); curdir = NULL;
+
+//printf("2saved: %p %d %d %d %d\n",saved,saved[0],saved[1],saved[2],saved[3]);
+  sf_restoreareaandfree(saved);
+
+  if (c == ZC_ESCAPE) return -1;
+
+  if (c == ZC_RETURN)
+       {
+       strcpy(buffer,lastdir);
+       strcat(buffer,filename);
+       *res = buffer;
+       return 0;
+       }
+
+  return SF_NOTIMP;
+  }
+
+void sf_setdialog(void)
+{
+  sf_osdialog = myosdialog;
+}
+
+///////////////////////////////////
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef WIN32
+#define strcasecmp stricmp
+#else
+#include <strings.h>
+#endif
+#include <unistd.h>
+#include <dirent.h>
+//#include <fnmatch.h>
+#include <sys/stat.h>
+
+// simplified fnmatch - only allows a single * at beginning
+STATIC int myfnmatch( const char *pattern, const char *p, int dummy)
+  {
+  int lpat, lp;
+  if (!pattern) return -1;
+  if (!p) return -1;
+  if (pattern[0] != '*') return strcmp(pattern,p);
+  lpat = strlen(pattern);
+  if (lpat == 1) return 0;     // * matches anything
+  lpat--; pattern++;
+  lp = strlen(p);
+  if (lp < lpat) return 1;     // too short
+  return strcmp(pattern,p+lp-lpat);
+  }
+
+STATIC void cleanlist( ENTRY *t)
+  {
+  while (t)
+       {
+       ENTRY *n = t->right;
+       if (t->value) free(t->value);
+       free(t);
+       t = n;
+       }
+  }
+
+STATIC ENTRY * newentry( char *s)
+  {
+  ENTRY *r = calloc(1,sizeof(ENTRY));
+
+  if (r){
+       r->value = strdup(s);
+       if (!r->value){ free(r); return NULL;}
+       }
+  return r;
+  }
+
+STATIC void addentry( char *s, ENTRY **ae)
+  {
+  ENTRY *t = *ae;
+  if (!t)
+       {
+       *ae = newentry(s);
+       return;
+       }
+  for (;;)
+       {
+       int k = strcasecmp(s,t->value);
+       if (!k) return;
+       if (k > 0)
+               {
+               if (t->right) t = t->right;
+               else
+                       {
+                       t->right = newentry(s);
+                       return;
+                       }
+               }
+       else
+               {
+               if (t->left) t = t->left;
+               else
+                       {
+                       t->left = newentry(s);
+                       return;
+                       }
+               }
+       }
+  }
+
+STATIC char *resolvedir( char *dir, char *res, int size)
+  {
+  char cwd[FILENAME_MAX], *p; int i;
+  if (!getcwd(cwd,FILENAME_MAX)) return NULL;
+  if (chdir(dir)) return NULL;
+  p = getcwd(res,size);
+  for (i=0;p[i];i++) if (p[i]=='\\') p[i] = '/';
+  chdir(cwd);
+  if (p)
+       {
+       int n = strlen(p);
+       if (n) if (p[n-1] != '/') { p[n] = '/'; p[n+1] = 0;}
+       }
+  return p;
+  }
+
+STATIC ENTRY * dodir(
+       char *dirname, char *pattern, char *resdir, int size, int *ndirs, int *ntot)
+  {
+  DIR *dir;
+  ENTRY *dirs = NULL;
+  ENTRY *files = NULL, *res = NULL;
+  struct dirent *d;
+  char *p, *resdend;
+  struct stat fst;
+  int n;
+
+  void exhaust( ENTRY *e)
+    {
+    if (!e) return;
+    exhaust(e->left);
+    e->left = res;
+    res = e;
+    n++;
+    exhaust(e->right);
+    }
+
+//printf("\ndodir\n");
+  if (!resolvedir(dirname,resdir,size)) return NULL;
+  resdend = resdir+strlen(resdir);
+
+//printf("[%s]\n",resdir);
+       // MinGW opendir() does not like the final slash
+#ifdef WIN32
+  n = strlen(resdir);
+  if (n > 2 && (resdir[n-2] != ':'))
+       resdir[n-1] = 0;
+  dir = opendir(resdir);
+  resdir[n-1] = '/';
+#else
+  dir = opendir(resdir);
+#endif
+  if (!dir) return NULL;
+
+//printf("opened [%s]\n",resdir);
+  for (;;)
+    {
+    d = readdir(dir);
+    if (!d) break;
+    p = d->d_name;
+    if (strcmp(p,".")==0) continue;
+    if (strcmp(p,"..")==0) continue;
+    strcpy(resdend,p);
+//printf("-%s\n",resdir);
+    if (stat(resdir,&fst)) continue;
+//printf("--mode %x\n",fst.st_mode);
+    if (S_ISDIR(fst.st_mode))
+       addentry(p,&dirs);
+    else
+       {
+//printf("--fnmatch: %d\n",fnmatch(pattern,p,0));
+       if (myfnmatch(pattern,p,0)==0) addentry(p,&files);
+       }
+    }
+
+  closedir(dir);
+  *resdend = 0;
+
+  n = 0;
+  exhaust(dirs);
+  *ndirs = n;
+  exhaust(files);
+  *ntot = n;
+
+  if (res)
+    while (res->left)
+       {
+       ((ENTRY *)(res->left))->right = res;
+       res = res->left;
+       }
+
+  return res;
+  }
+
+
+//////////////////////////////////////////////
+// white,black,gray,yellow
+static ulong bcolors[4] = {0xfcfcfc,0,0xa0a0a0,0xa0d0e0};
+
+static unsigned char folderbmp[] = {
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,1,1,1,1,1,1,
+       0,0,0,0,0,0,0,0,
+       0,1,3,3,3,3,3,3,
+       1,1,1,1,1,1,0,0,
+       0,1,3,3,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,1,3,3,3,3,3,3,
+       3,1,1,1,1,1,1,0,
+       0,1,3,3,1,1,1,1,
+       1,3,3,3,3,3,1,0,
+       0,1,3,1,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,1,3,1,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,1,3,1,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,1,3,1,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,1,3,1,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,1,3,1,3,3,3,3,
+       3,3,3,3,3,3,1,0,
+       0,0,1,1,1,1,1,1,
+       1,1,1,1,1,1,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0};
+
+
+static unsigned char docbmp[] = {
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,1,1,1,1,1,1,
+       1,1,1,1,1,1,0,0,
+       0,1,0,0,0,0,0,0,
+       0,0,0,0,0,0,1,0,
+       0,1,0,2,2,2,2,2,
+       2,2,2,2,2,0,1,0,
+       0,1,0,0,0,0,0,0,
+       0,0,0,0,0,0,1,0,
+       0,1,0,2,2,2,2,2,
+       2,2,2,2,2,0,1,0,
+       0,1,0,0,0,0,0,0,
+       0,0,0,0,0,0,1,0,
+       0,1,0,2,2,2,2,2,
+       2,2,2,2,2,0,1,0,
+       0,1,0,0,0,0,0,0,
+       0,0,0,0,0,0,1,0,
+       0,1,0,2,2,2,2,2,
+       2,2,2,2,2,0,1,0,
+       0,1,0,0,0,0,0,0,
+       0,0,0,0,0,0,1,0,
+       0,1,0,0,0,0,0,0,
+       0,0,0,0,0,0,1,0,
+       0,0,1,1,1,1,1,1,
+       1,1,1,1,1,1,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0,
+       0,0,0,0,0,0,0,0};
+
+////////////////////////////////
+
+STATIC void drawit( int x, int y, ENTRY *e, int w, int issub)
+  {
+  int i, j, n, color;
+  unsigned char *bmp;
+  char *s = e->value;
+  bmp = (issub ? folderbmp : docbmp);
+  for (i=0;i<16;i++) for (j=0;j<16;j++) sf_wpixel(x+j,y+i,bcolors[*bmp++]);
+  x += 17;
+  w -= 17;
+  n = w/8;
+  if (n < 1) return;
+  if (strlen(s) > n)
+       {
+       strcpy(buffer,s);
+       buffer[n] = 0;
+       buffer[n-1] = '>';
+       s = buffer;
+       }
+  if (e == selected)
+       {
+       color = O_WHITE;
+       sf_fillrect(0,x,y,w,16);
+       }
+  else
+       color = O_BLACK;
+  writetext(color,s,x,y,w,0);
+  }
+
+static int Nrows, Ncols, Ewid, Fh;
+
+STATIC void drawnames( int x, int y, int w, int h, ENTRY *files, int first, int nsub, int ntot, int ewid)
+  {
+  int i;
+
+  Fh = 16;
+  Ewid = ewid;
+  Ncols = w/ewid;
+  Nrows = h/Fh;
+
+  sf_fillrect(O_WHITE,x,y,w,h);
+  if (!files) return;
+  if (first < 0) return;
+  if (nsub > ntot) nsub = ntot;
+  while (first > 0)
+       {
+       files = files->right;
+       if (!files) return;
+       nsub--;
+       ntot--;
+       first--;
+       }
+  if (ntot <= 0) return;
+  if (Ncols < 1) return;
+  if (Nrows < 1) return;
+  if (Nrows*Ncols < ntot) ntot = Nrows*Ncols;
+  for (i=0;i<ntot;i++)
+       {
+       drawit(x+ewid*(i/Nrows),y+Fh*(i % Nrows),files,ewid,i < nsub);
+       files = files->right;
+       }
+  }
+
+STATIC void drawlist()
+  {
+  BAREA *a = bareas+A_list, *b = bareas+A_dir;
+
+  clarea(A_dir);
+  writetext(0,lastdir,b->x,b->y,b->w,0);
+  drawnames(a->x,a->y,a->w,a->h,curdir,First,Numdirs,Numtot,21*8);
+
+  }
+
+STATIC void goright()
+  {
+  if (First+Nrows*Ncols > Numtot) return;
+  First += Nrows;
+  drawlist();
+  }
+
+STATIC void goleft()
+  {
+  if (!First) return;
+  First -= Nrows;
+  drawlist();
+  }
+
+STATIC ENTRY *filesat( int n){
+  ENTRY *e = curdir;
+  while (n--)
+       {
+       if (e) e = e->right;
+       }
+  return e;
+  }
+
+STATIC zword Zselect( int x, int y)
+  {
+  int n;
+  x /= Ewid;
+  y /= Fh;
+  n = First + y + x*Nrows;
+  if (n >= Numtot)
+       {
+       if (selected)
+               {
+               selected = NULL;
+               drawlist();
+               }
+       return 0;
+       }
+  if (n < Numdirs)
+       {
+       ENTRY *e = filesat(n);
+       if (!e) return 0;
+       strcat(lastdir,e->value);
+       updatelist();
+       return 0;
+       }
+  selected = curdir;
+  while (n--) selected = selected->right;
+  strcpy(filename,selected->value);
+  showfilename(-1);
+  drawlist();
+  return 0;
+  }
+
+extern void sf_videodata( ulong **sb, int *sp, int *ew, int *eh);
+zword sf_yesnooverlay( int xc, int yc, char *t, int saverest)
+  {
+  zword c = ZC_RETURN;
+  int nsav = nbareas;
+  ulong *saved = NULL;
+  int hx = BUTTW+3*SPC, hy = HTEXT+2*SPC, heff;
+
+  heff = 8*strlen(t);
+  if (heff > 2*hx) hx = (heff+3)/2;
+  if (saverest)
+       {
+       ts = sf_curtextsetting();
+       if (!ts) return ZC_ESCAPE;
+       saved = sf_savearea(xc-hx-2,yc-hy-2,2*hx+4,2*hy+4);
+       if (!saved) return ZC_ESCAPE;
+       sf_pushtextsettings();
+       ts->font = sf_VGA_SFONT;
+       ts->style = 0;
+       ts->oh = 0;
+       ts->fore = 0;
+       ts->backTransparent = 1;
+       sf_videodata(&sbuffer, &sbpitch, &ewidth, &eheight);
+       }
+
+  sf_fillrect(FRAMECOLOR,xc-hx-2,yc-hy-2,2*hx+4,2*hy+4);
+  sf_fillrect(O_WHITE,xc-hx,yc-hy,2*hx,2*hy);
+  writetext(O_BLACK,t,xc-hx,yc-SPC-HTEXT,2*hx,1);
+  addbutton(xc-SPC-BUTTW,yc+SPC,BUTTW,HTEXT,"Yes",Zok);
+  addbutton(xc+SPC,yc+SPC,BUTTW,HTEXT,"No",Zcanc);
+  for (;;)
+    {
+    c = inputkey();
+    if (c == 'n' || c == 'N') c = ZC_ESCAPE;
+    if (c == 'y' || c == 'Y') c = ZC_RETURN;
+    if (c == ZC_SINGLE_CLICK) c = checkmouse(nsav);
+    if (c == ZC_ESCAPE) break;
+    if (c == ZC_RETURN) break;
+    }
+
+  if (saved)
+       {
+       sf_restoreareaandfree(saved);
+       sf_poptextsettings();
+       }
+
+  nbareas = nsav;
+  return c;
+  }
+
+STATIC zword yesnoover( int xc, int yc)
+  {
+  zword c;
+
+  c = sf_yesnooverlay(xc,yc,"Overwrite file?",0);
+
+  drawlist();
+  return c;
+  }
+
+// this is needed for overlapping source and dest in Zentry
+// (lib does not guarantee correct behaviour in that case)
+static void mystrcpy( char *d, const char *s)
+  {
+  while ((*d++ = *s++));
+  }
+
+STATIC zword Zentry( int x, int y)
+  {
+  static int pos = 10000;
+  int i,n,nmax; zword c;
+
+  nmax = wentry/8;
+  if (nmax >= FILENAME_MAX) nmax = FILENAME_MAX-1;
+  n = strlen(filename);
+  if (n > nmax) { n = nmax; filename[n] = 0;}
+  if (y >= 0)
+    {
+    pos = x/4-1; if (pos < 0) pos = 0;
+    pos /= 2;
+    }
+  if (pos > n) pos = n;
+  showfilename(pos);
+  for (;;)
+    {
+    c = inputkey();
+    if (c == ZC_SINGLE_CLICK)
+       {
+       pushed = c;
+       c = 0;
+       break;
+       }
+    if (c == ZC_ESCAPE || c == VK_INS) { c = 0; break; }
+    if (c == ZC_RETURN) break;
+    if (c == ZC_ARROW_LEFT)
+       {
+       if (pos){ pos--; showfilename(pos); }
+       continue;
+       }
+    if (c == ZC_ARROW_RIGHT)
+       {
+       if (pos < n){ pos++; showfilename(pos); }
+       continue;
+       }
+    if (c == ZC_BACKSPACE)
+       {
+       if (pos)
+               {
+                       // needs mystrcpy() because overlapping src-dst
+               if (pos < n) mystrcpy(filename+pos-1,filename+pos);
+               n--;
+               filename[n] = 0;
+               pos--;
+               showfilename(pos);
+               }
+       continue;
+       }
+    if ((c >= 32 && c < 127) || (c >= 160 && c < 256))
+       {
+       if (n >= nmax) continue;
+       if (n > pos)
+         for (i=n;i>pos;i--) filename[i] = filename[i-1];
+       filename[pos] = c;
+       n++;
+       filename[n] = 0;
+       pos++;
+       showfilename(pos);
+       }
+    }
+  showfilename(-1);
+  return c;
+  }
+
+
index dd7023bb4b8de4bb0ffb90889447873be119a366..e976e5adbfb0bd8cbac73cf119938db764a0d8d7 100644 (file)
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-//#include <signal.h>\r
-\r
-//#define STATIC\r
-\r
-#include <SDL.h>\r
-\r
-#include "generic.h"\r
-\r
-#include "../common/defines.h"\r
-#include "sf_frotz.h"\r
-\r
-static SDL_Rect blitrect = {0,0,0,0};\r
-static char banner[256];\r
-static int isfullscreen;\r
-static ulong *sbuffer = NULL;\r
-static int sbpitch;            // in longs\r
-static int dirty = 0;\r
-static int bitsperpixel = 32;\r
-static int RBswap = 0;\r
-static int ewidth, eheight;\r
-static SDL_Surface *screen, *off = NULL;\r
-static int mustlockscreen = 0;\r
-int m_timerinterval = 100;\r
-\r
-static void sf_quitconf();\r
-\r
-// clipping region\r
-static int xmin,xmax,ymin,ymax;\r
-\r
-void sf_setclip( int x, int y, int w, int h)\r
-  {\r
-  if (x < 0){ w += x; x = 0;}\r
-  if (x+w > ewidth) w = ewidth-x;\r
-  if (y < 0){ h += y; y = 0;}\r
-  if (y+h > eheight) h = eheight-y;\r
-  xmin = x; xmax = x+w;\r
-  ymin = y; ymax = y+h;\r
-  }\r
-\r
-void sf_getclip( int *x, int *y, int *w, int *h)\r
-  {\r
-  *x = xmin; *y = ymin;\r
-  *w = xmax-xmin; *h = ymax-ymin;\r
-  }\r
-\r
-static int mywcslen( zchar *b)\r
-  {\r
-  int n=0;\r
-  while (*b++) n++;\r
-  return n;\r
-  }\r
-\r
-static void myGrefresh(){\r
-  if (off) {\r
-    if (mustlockscreen) SDL_LockSurface(screen);\r
-    SDL_BlitSurface(off,NULL,screen,&blitrect);\r
-    if (mustlockscreen) SDL_UnlockSurface(screen);\r
-    }\r
-  SDL_UpdateRect(screen,0,0,0,0);\r
-  }\r
-\r
-void sf_wpixel( int x, int y, ulong c)\r
-  {\r
-  if (x < xmin || x >= xmax || y < ymin || y >= ymax) return;\r
-  sbuffer[x+sbpitch*y] = c;\r
-  dirty = 1;\r
-  }\r
-\r
-ulong sf_rpixel( int x, int y)\r
-  {\r
-  if (x < 0 || x >= ewidth || y < 0 || y >= eheight) return 0;\r
-  return sbuffer[x+sbpitch*y];\r
-  }\r
-\r
-#define MAXCUR 64\r
-static ulong savedcur[MAXCUR];\r
-\r
-static void drawthecursor( int x, int y, int onoff)\r
-  {\r
-  SF_textsetting * ts = sf_curtextsetting();\r
-  int i, h = ts->font->height(ts->font);\r
-  if (h > MAXCUR) h = MAXCUR;\r
-  if (onoff)\r
-       {\r
-       for (i=0;i<h;i++) \r
-               {\r
-               savedcur[i] = sf_rpixel(x,y+i);\r
-               sf_wpixel(x,y+i,ts->fore);\r
-               }\r
-       }\r
-  else\r
-       {\r
-       for (i=0;i<h;i++) \r
-               {\r
-               sf_wpixel(x,y+i,savedcur[i]);\r
-               }\r
-       }\r
-  }\r
-\r
-bool sf_IsValidChar(unsigned short c)\r
-  {\r
-  if (c >= ZC_ASCII_MIN && c <= ZC_ASCII_MAX)\r
-       return true;\r
-  if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX)\r
-       return true;\r
-  if (c >= 0x100)\r
-       return true;\r
-  return false;\r
-  }\r
-\r
-void sf_drawcursor( bool c)\r
-  {\r
-  SF_textsetting * ts = sf_curtextsetting();\r
-  drawthecursor(ts->cx,ts->cy,c);\r
-  }\r
-\r
-void sf_chline( int x, int y, ulong c, int n)\r
-  {\r
-  ulong *s;\r
-  if (y < ymin || y >= ymax) return;\r
-  if (x < xmin){ n += x-xmin; x = xmin;}\r
-  if (x+n > xmax) n = xmax-x;\r
-  if (n <= 0) return;\r
-  s = sbuffer+x+sbpitch*y;\r
-  while (n--) *s++ = c;\r
-  dirty = 1;\r
-  }\r
-\r
-void sf_cvline( int x, int y, ulong c, int n)\r
-  {\r
-  ulong *s;\r
-  if (x < xmin || x >= xmax) return;\r
-  if (y < xmin){ n += y-ymin; y = ymin;}\r
-  if (y+n > ymax) n = ymax-y;\r
-  if (n <= 0) return;\r
-  s = sbuffer+x+sbpitch*y;\r
-  while (n--) { *s = c; s += sbpitch;}\r
-  dirty = 1;\r
-  }\r
-\r
-\r
-ulong sf_blendlinear( int a, ulong s, ulong d){\r
-  ulong r;\r
-  r = ((s & 0xff)*a + (d & 0xff)*(256-a))>>8;\r
-  s >>= 8; d >>= 8;\r
-  r |= (((s & 0xff)*a + (d & 0xff)*(256-a))>>8)<<8;\r
-  s >>= 8; d >>= 8;\r
-  r |= (((s & 0xff)*a + (d & 0xff)*(256-a))>>8)<<16;\r
-  return r;\r
-  }\r
-\r
-void sf_writeglyph( SF_glyph *g)\r
-  {\r
-  SF_textsetting *ts = sf_curtextsetting();\r
-\r
-  int i,j,m;\r
-\r
-  int w = g->dx;\r
-  int weff = g->xof+g->w;\r
-  byte * bmp = (byte *)(&(g->bitmap[0]));\r
-  int h = g->h;\r
-  int nby = (g->w+7)/8;\r
-  int byw = g->w;\r
-\r
-  int x = ts->cx;\r
-  int y = ts->cy;\r
-\r
-  int dxpre = g->xof;\r
-  int dypre = ts->font->ascent(ts->font)-h-(int)g->yof;\r
-\r
-  int height = ts->font->height(ts->font);\r
-  int width;\r
-\r
-  ulong color, bc;\r
-\r
-  if ((ts->style & REVERSE_STYLE) != 0)\r
-       {\r
-       bc = ts->fore;\r
-       color = ts->back;\r
-       }\r
-  else\r
-       {\r
-       color = ts->fore;\r
-       bc = ts->back;\r
-       }\r
-\r
-       // compute size and position of background rect\r
-\r
-  if (weff < w) weff = w;\r
-  width = weff - ts->oh;\r
-  if ((width > 0) && (ts->backTransparent == 0))\r
-       sf_fillrect(bc,x+ts->oh,y,width,height);\r
-\r
-  x += dxpre;\r
-  y += dypre;\r
-\r
-//printf("\n");\r
-  for (i=0;i<h;i++)\r
-    {\r
-    int xx = 0;\r
-    if (ts->font->antialiased)\r
-      for (m=0;m<byw;m++)\r
-       {\r
-       int t = *bmp++;\r
-       if (xx < byw)\r
-           {\r
-           if (t)\r
-               {\r
-               ulong sval = color;\r
-               if (t < 255)\r
-                 sval = sf_blend((int)(t + (t>>7)),sval,sf_rpixel(x+xx,y));\r
-               sf_wpixel( x+xx, y, sval);\r
-               }\r
-           }\r
-       xx++;\r
-       }\r
-    else\r
-      for (m=0;m<nby;m++)\r
-       {\r
-       int t = *bmp++;\r
-       for (j=0;j<8;j++, t *= 2)\r
-         {\r
-         if (xx < byw)\r
-           {\r
-           if (t & 0x80)\r
-               sf_wpixel( x+xx, y, color);\r
-           }\r
-         xx++;\r
-         }\r
-       }\r
-    y++;\r
-    }\r
-\r
-  ts->cx += (w);\r
-  ts->oh = (weff > w) ? weff-w : 0;\r
-  }\r
-\r
-\r
-void sf_fillrect( unsigned long color, int x, int y, int w, int h)\r
-  {\r
-  ulong *dst;\r
-  int i;\r
-//printf("fillrect %x %d %d %d %d\n",color,x,y,w,h);\r
-//printf("dst%p sbpitch%d\n",dst,sbpitch);\r
-  if (x < xmin){ w += x-xmin; x = xmin;}\r
-  if (x+w > xmax) w = xmax-x;\r
-  if (w <= 0) return;\r
-  if (y < ymin){ h += y-ymin; y = ymin;}\r
-  if (y+h > ymax) h = ymax-y;\r
-  if (h <= 0) return;\r
-  dst = sbuffer+x+sbpitch*y;\r
-  while (h--)\r
-       {\r
-       for (i=0;i<w;i++) dst[i] = color;\r
-       dst += sbpitch;\r
-       }\r
-  dirty = 1;\r
-  }\r
-\r
-void sf_rect( unsigned long color, int x, int y, int w, int h)\r
-  {\r
-  sf_chline(x,y,color,w);\r
-  sf_chline(x,y+h-1,color,w);\r
-  sf_cvline(x,y,color,h);\r
-  sf_cvline(x+w-1,y,color,h);\r
-  }\r
-\r
-\r
-void sf_flushtext()\r
-  {\r
-  SF_textsetting *ts = sf_curtextsetting();\r
-  ts->cx += ts->oh;\r
-  ts->oh = 0;\r
-  }\r
-\r
-/*\r
- * os_erase_area\r
- *\r
- * Fill a rectangular area of the screen with the current background\r
- * colour. Top left coordinates are (1,1). The cursor does not move.\r
- *\r
- * The final argument gives the window being changed, -1 if only a\r
- * portion of a window is being erased, or -2 if the whole screen is\r
- * being erased.\r
- *\r
- */\r
-void os_erase_area(int top, int left, int bottom, int right, int win)\r
-  {\r
-  sf_flushtext();\r
-  sf_fillrect((sf_curtextsetting())->back,left-1,top-1,right-left+1,bottom-top+1);\r
-//     theWnd->FillBackground(CRect(left-1,top-1,right,bottom));\r
-  }\r
-\r
-/*\r
- * os_peek_colour\r
- *\r
- * Return the colour of the screen unit below the cursor. (If the\r
- * interface uses a text mode, it may return the background colour\r
- * of the character at the cursor position instead.) This is used\r
- * when text is printed on top of pictures. Note that this coulor\r
- * need not be in the standard set of Z-machine colours. To handle\r
- * this situation, Frotz entends the colour scheme: Colours above\r
- * 15 (and below 256) may be used by the interface to refer to non\r
- * standard colours. Of course, os_set_colour must be able to deal\r
- * with these colours.\r
- *\r
- */\r
-int os_peek_colour(void)\r
-  {\r
-  SF_textsetting *ts = sf_curtextsetting();\r
-  sf_flushtext();\r
-  return sf_GetColourIndex(sf_rpixel(ts->cx,ts->cy));\r
-  }\r
-\r
-static void scroll( int x, int y, int w, int h, int n)\r
-  {\r
-  ulong *src, *dst;\r
-  int nmove, step;\r
-  if (n > 0)\r
-       {\r
-       dst = sbuffer+x+sbpitch*y;\r
-       src = dst + n*sbpitch;\r
-       nmove = h-n;\r
-       step = sbpitch;\r
-       }\r
-  else if (n < 0)\r
-       {\r
-       n = -n;\r
-       nmove = h-n;\r
-       step = -sbpitch;\r
-       src = sbuffer+x+sbpitch*(y+nmove-1);\r
-       dst = src + n*sbpitch;\r
-       }\r
-  else\r
-       return;\r
-  if (nmove > 0)\r
-    {\r
-    while (nmove--)\r
-       {\r
-       memcpy(dst,src,w*sizeof(ulong));\r
-       dst += step;\r
-       src += step;\r
-       }\r
-    dirty = 1;\r
-    }\r
-  }\r
-\r
-void sf_flushdisplay()\r
-  {\r
-  if (dirty) myGrefresh();\r
-  dirty = 0;\r
-  }\r
-\r
-/*\r
- * os_scroll_area\r
- *\r
- * Scroll a rectangular area of the screen up (units > 0) or down\r
- * (units < 0) and fill the empty space with the current background\r
- * colour. Top left coordinates are (1,1). The cursor stays put.\r
- *\r
- */\r
-void os_scroll_area(int top, int left, int bottom, int right, int units)\r
-  {\r
-  sf_flushtext();\r
-//     theWnd->ResetOverhang();\r
-\r
-  scroll(left-1,top-1,right-left+1,bottom-top+1,units);\r
-  if (units > 0)\r
-       sf_fillrect((sf_curtextsetting())->back,left-1,bottom-units,right-left+1,units);\r
-  else if (units < 0)\r
-       sf_fillrect((sf_curtextsetting())->back,left-1,top-1,right-left+1,units);\r
-\r
-//  if (theApp.GetFastScrolling() == false)\r
-//  sf_flushdisplay();\r
-//             theWnd->FlushDisplay();\r
-  }\r
-\r
-bool os_repaint_window(int win, int ypos_old, int ypos_new, int xpos,\r
-                       int ysize, int xsize)\r
-{\r
-    //TODO\r
-    return FALSE;\r
-}\r
-\r
-\r
-int SFdticks = 200;\r
-volatile bool SFticked = 0;\r
-static SDL_TimerID timerid = 0;\r
-\r
-static Uint32 mytimer( Uint32 inter, void *parm)\r
-  {\r
-  SFticked = true;\r
-  return inter;\r
-  }\r
-\r
-static void cleanvideo()\r
-  {\r
-  if (timerid) SDL_RemoveTimer(timerid);\r
-  SDL_Quit();\r
-  }\r
-\r
-#define RM 0x0000ff\r
-#define GM 0x00ff00\r
-#define BM 0xff0000\r
-\r
-static int check( int R, int G, int B){\r
-  if (R==RM && G==GM && B==BM) return 0;\r
-  if (R==BM && G==GM && B==RM) return -1;\r
-  return 1;\r
-  }\r
-\r
-extern char stripped_story_name[];\r
-\r
-void sf_initvideo( int W, int H, int full)\r
-  {\r
-  int desired_bpp, needoff, reqW, reqH;\r
-  Uint32 video_flags;\r
-  SDL_PixelFormat *format;\r
-  Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER |\r
-       SDL_INIT_AUDIO;\r
-\r
-  sprintf(banner,"SDL Frotz v%s - %s (z%d)",VERSION,\r
-       f_setup.story_name,h_version);\r
-  desired_bpp = 32;\r
-  video_flags = 0;\r
-\r
-  if ( SDL_Init(initflags) < 0 ) {\r
-       os_fatal("Couldn't initialize SDL: %s", SDL_GetError());\r
-       }\r
-\r
-  CLEANREG(cleanvideo);\r
-\r
-  isfullscreen = full;\r
-  if (full) video_flags = SDL_FULLSCREEN;\r
-  reqW = W; reqH = H;\r
-  if (full)\r
-       {\r
-       if (m_reqW == -1)\r
-               {\r
-               const SDL_VideoInfo * v = SDL_GetVideoInfo();\r
-               if (v) { m_reqW = v->current_w; m_reqH = v->current_h;}\r
-               }\r
-       if (m_reqW > reqW) reqW = m_reqW;\r
-       if (m_reqH > reqH) reqH = m_reqH;\r
-       }\r
-  screen = SDL_SetVideoMode( reqW, reqH, desired_bpp, video_flags);\r
-  if ( screen == NULL ) {\r
-       os_fatal("Couldn't set %dx%dx%d video mode: %s",\r
-               reqW, reqH, desired_bpp, SDL_GetError());\r
-       }\r
-  SDL_WM_SetCaption(banner,NULL);\r
-  bitsperpixel = 32;\r
-\r
-  mustlockscreen = SDL_MUSTLOCK(screen);\r
-  format = screen->format;\r
-\r
-  needoff = (mustlockscreen) || (screen->w != W) || (screen->h != H) ||\r
-       (format->BitsPerPixel != 24) ||\r
-       (screen->pitch != 3*W);\r
-\r
-  RBswap = 0;\r
-  if (!needoff) {\r
-    needoff = check(format->Rmask,format->Gmask,format->Bmask);\r
-    if ((needoff == -1)){\r
-       RBswap = 1;\r
-       needoff = 0;\r
-       }\r
-    else\r
-       needoff = 1;\r
-    }\r
-// printf("setvideo: gm %dx%d rq %dx%d(f%d) got %dx%d needoff %d\n", W,H,reqW,reqH,full,screen->w,screen->h,needoff);\r
-\r
-  if (needoff) {\r
-    sbuffer = calloc(W*H,sizeof(ulong));\r
-    if (!sbuffer){\r
-       os_fatal("Could not create gc");\r
-       }\r
-    off = SDL_CreateRGBSurfaceFrom(sbuffer,\r
-       W,H,32,4*W,0xff,0xff00,0xff0000,0);\r
-//     off = SDL_CreateRGBSurfaceFrom(sbuffer,\r
-//     W,H,32,4*screen->w,0xff,0xff00,0xff0000,0);\r
-    if (!off){\r
-       os_fatal("Could not create offscreen surface");\r
-       }\r
-    }\r
-  else {\r
-    sbuffer = (ulong *)screen->pixels;\r
-    }\r
-\r
-  blitrect.w = W; blitrect.h = H;\r
-  blitrect.x = (screen->w - W)/2;\r
-  blitrect.y = (screen->h - H)/2;\r
-  SDL_EnableUNICODE(1);\r
-  SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);\r
-\r
-  SDL_AddTimer(SFdticks,mytimer,NULL);\r
-\r
-  xmin = ymin = 0;\r
-  xmax = ewidth = W;\r
-  ymax = eheight = H;\r
-  sbpitch = W;\r
-  dirty = 1;\r
-  }\r
-\r
-/*\r
- * os_draw_picture\r
- *\r
- * Display a picture at the given coordinates.\r
- *\r
- */\r
-void os_draw_picture(int picture, int y, int x)\r
-  {\r
-  int ew, eh, xx, yy, ix, iy, d;\r
-  int ox, oy, ow, oh;\r
-  Zwindow * winpars;\r
-  sf_picture * pic = sf_getpic(picture);\r
-  ulong *src, *dst, sval, dval, alpha;\r
-\r
-  sf_flushtext();\r
-\r
-  if (!pic) return;\r
-  if (!pic->pixels) return;    // TODO: rect\r
-  src = (ulong *) pic->pixels;\r
-\r
-  x--; y--;\r
-  ew = m_gfxScale*pic->width;\r
-  eh = m_gfxScale*pic->height;\r
-\r
-       // this takes care of the fact taht x, y are really 16 bit values\r
-  if (x & 0x8000) x |= 0xffff0000;\r
-  if (y & 0x8000) y |= 0xffff0000;\r
-\r
-       // get current window rect\r
-  sf_getclip(&ox,&oy,&ow,&oh);\r
-  winpars = curwinrec();\r
-  sf_setclip( winpars->x_pos-1, winpars->y_pos-1, winpars->x_size, winpars->y_size);\r
-\r
-       // clip taking into account possible origin\r
-       // outside the clipping rect\r
-  if (x < xmin) { d = xmin-x; ew -= d; x = xmin; src += d;}\r
-  if (x+ew > xmax) ew = xmax - x;\r
-  ew /= m_gfxScale;\r
-\r
-  if (y < ymin) { d = ymin-y; eh -= d; y = ymin; src += d*pic->width;}\r
-  if (y+eh > ymax) eh = ymax-y;\r
-  eh /= m_gfxScale;\r
-\r
-  sf_setclip(ox,oy,ow,oh);\r
-\r
-  if (ew <= 0) return;\r
-  if (eh <= 0) return;\r
-\r
-  for (yy=0;yy<eh;yy++)\r
-    {\r
-    for (xx=0;xx<ew;xx++)\r
-       {\r
-       dst = sbuffer + x +xx*m_gfxScale + sbpitch*(y + yy*m_gfxScale);\r
-       sval = src[xx];\r
-       alpha = (sval >> 24);\r
-       if (alpha == 255)\r
-               dval = sval & 0xffffff;\r
-       else\r
-               dval = sf_blend((int)(alpha + (alpha>>7)),sval,dst[0]);\r
-       for (iy=0;iy<m_gfxScale;iy++)\r
-         {\r
-         for (ix=0;ix<m_gfxScale;ix++) dst[ix] = dval;\r
-         dst += sbpitch;\r
-         }\r
-       }\r
-    src += pic->width;\r
-    }\r
-\r
-  dirty = 1;\r
-  }\r
-\r
-static ulong mytimeout;\r
-int mouse_button;\r
-static int numAltQ = 0;\r
-\r
-static zword goodzkey( SDL_Event *e, int allowed)\r
-  {\r
-  zword c;\r
-  if (e->type == SDL_QUIT)\r
-       {\r
-       sf_quitconf();\r
-//     if (allowed) return ZC_HKEY_QUIT;\r
-       return 0;\r
-       }\r
-  if (e->type == SDL_MOUSEBUTTONDOWN)\r
-       {\r
-//printf("down %d\n",e->button.button);\r
-       if (true)       //(e->button.button == SDL_BUTTON_LEFT)\r
-               {\r
-               mouse_button = e->button.button;\r
-               mouse_x = e->button.x+1-blitrect.x;\r
-               mouse_y = e->button.y+1-blitrect.y;\r
-               return ZC_SINGLE_CLICK;\r
-               }\r
-       return 0;\r
-       }\r
-  if (e->type != SDL_KEYDOWN) return 0;\r
-       // emergency exit\r
-  if (((e->key.keysym.mod & 0xfff) == (KMOD_LALT | KMOD_LCTRL)) && (e->key.keysym.sym == 'x'))\r
-       os_fatal("Emergency exit!\n\n(Control-Alt-X pressed)");\r
-  if (((e->key.keysym.mod & KMOD_LALT) == KMOD_LALT) ||\r
-       ((e->key.keysym.mod & KMOD_RALT) == KMOD_RALT))\r
-       {\r
-       if (e->key.keysym.sym == 'q')\r
-               {\r
-               numAltQ++;\r
-               if (numAltQ > 2)\r
-                       os_fatal("Emergency exit!\n\n(Alt-Q pressed 3 times in succession)");\r
-               }\r
-       else numAltQ = 0;\r
-       if (!allowed) return 0;\r
-       switch (e->key.keysym.sym)\r
-         {\r
-         case 'x': return ZC_HKEY_QUIT;\r
-         case 'p': return ZC_HKEY_PLAYBACK;\r
-         case 'r': return ZC_HKEY_RECORD;\r
-         case 's': return ZC_HKEY_SEED;\r
-         case 'u': return ZC_HKEY_UNDO;\r
-         case 'n': return ZC_HKEY_RESTART;\r
-         case 'd': return ZC_HKEY_DEBUG;\r
-         case 'h': return ZC_HKEY_HELP;\r
-         default: return 0;\r
-         }\r
-       }\r
-  else numAltQ = 0;\r
-  switch (e->key.keysym.sym)\r
-       {\r
-       case SDLK_INSERT:       return (allowed ? VK_INS : 0);\r
-       case SDLK_BACKSPACE:    return ZC_BACKSPACE;\r
-       case SDLK_ESCAPE:       return ZC_ESCAPE;\r
-       case SDLK_RETURN:       return ZC_RETURN;\r
-       case SDLK_UP:           return ZC_ARROW_UP;\r
-       case SDLK_DOWN:         return ZC_ARROW_DOWN;\r
-       case SDLK_LEFT:         return ZC_ARROW_LEFT;\r
-       case SDLK_RIGHT:        return ZC_ARROW_RIGHT;\r
-       case SDLK_TAB:          return (allowed ? VK_TAB : 0);\r
-       case SDLK_PAGEUP:       return (allowed ? VK_PAGE_UP : 0);\r
-       case SDLK_PAGEDOWN:     return (allowed ? VK_PAGE_DOWN : 0);\r
-       case SDLK_KP0:          return ZC_NUMPAD_MIN+0;\r
-       case SDLK_KP1:          return ZC_NUMPAD_MIN+1;\r
-       case SDLK_KP2:          return ZC_NUMPAD_MIN+2;\r
-       case SDLK_KP3:          return ZC_NUMPAD_MIN+3;\r
-       case SDLK_KP4:          return ZC_NUMPAD_MIN+4;\r
-       case SDLK_KP5:          return ZC_NUMPAD_MIN+5;\r
-       case SDLK_KP6:          return ZC_NUMPAD_MIN+6;\r
-       case SDLK_KP7:          return ZC_NUMPAD_MIN+7;\r
-       case SDLK_KP8:          return ZC_NUMPAD_MIN+8;\r
-       case SDLK_KP9:          return ZC_NUMPAD_MIN+9;\r
-       case SDLK_F1:           return ZC_FKEY_MIN+0;\r
-       case SDLK_F2:           return ZC_FKEY_MIN+1;\r
-       case SDLK_F3:           return ZC_FKEY_MIN+2;\r
-       case SDLK_F4:           return ZC_FKEY_MIN+3;\r
-       case SDLK_F5:           return ZC_FKEY_MIN+4;\r
-       case SDLK_F6:           return ZC_FKEY_MIN+5;\r
-       case SDLK_F7:           return ZC_FKEY_MIN+6;\r
-       case SDLK_F8:           return ZC_FKEY_MIN+7;\r
-       case SDLK_F9:           return ZC_FKEY_MIN+8;\r
-       case SDLK_F10:          return ZC_FKEY_MIN+9;\r
-       case SDLK_F11:          return ZC_FKEY_MIN+10;\r
-       case SDLK_F12:          return ZC_FKEY_MIN+11;\r
-       default: break;\r
-       }\r
-  c = e->key.keysym.unicode;\r
-  if ((c >= 32 && c <= 126) || (c >= 160)) return c;\r
-  return 0;\r
-  }\r
-\r
-zword sf_read_key( int timeout, int cursor, int allowed)\r
-  {\r
-  SDL_Event event;\r
-  zword inch = 0;\r
-\r
-  sf_flushtext();\r
-//     theWnd->ResetOverhang();\r
-//     theWnd->UpdateMenus();\r
-  if (cursor)\r
-       sf_drawcursor(true);\r
-  sf_flushdisplay();\r
-\r
-  if (timeout) mytimeout = sf_ticks() + m_timerinterval*timeout;\r
-//     InputTimer timer(timeout);\r
-//     FrotzWnd::Input input;\r
-  while (true)\r
-    {\r
-               // Get the next input\r
-    while (SDL_PollEvent(&event)) \r
-       {\r
-//if (event.type == SDL_QUIT) printf("got SDL_QUIT\n");\r
-       if ((inch = goodzkey(&event,allowed))) \r
-               break;\r
-       }\r
-    if (inch) break;\r
-    if ((timeout) && (sf_ticks() >= mytimeout))\r
-       {\r
-       inch = ZC_TIME_OUT;\r
-       break;\r
-       }\r
-    sf_checksound();\r
-    sf_sleep(10);\r
-    }\r
-\r
-  if (cursor)\r
-       sf_drawcursor(false);\r
-\r
-  return inch;\r
-  }\r
-\r
-\r
-/*\r
- * os_read_key\r
- *\r
- * Read a single character from the keyboard (or a mouse click) and\r
- * return it. Input aborts after timeout/10 seconds.\r
- *\r
- */\r
-zchar os_read_key(int timeout, int cursor)\r
-  {\r
-  return sf_read_key(timeout,cursor,0);\r
-  }\r
-\r
-\r
-/*\r
- * os_read_line\r
- *\r
- * Read a line of input from the keyboard into a buffer. The buffer\r
- * may already be primed with some text. In this case, the "initial"\r
- * text is already displayed on the screen. After the input action\r
- * is complete, the function returns with the terminating key value.\r
- * The length of the input should not exceed "max" characters plus\r
- * an extra 0 terminator.\r
- *\r
- * Terminating keys are the return key (13) and all function keys\r
- * (see the Specification of the Z-machine) which are accepted by\r
- * the is_terminator function. Mouse clicks behave like function\r
- * keys except that the mouse position is stored in global variables\r
- * "mouse_x" and "mouse_y" (top left coordinates are (1,1)).\r
- *\r
- * Furthermore, Frotz introduces some special terminating keys:\r
- *\r
- *     ZC_HKEY_PLAYBACK (Alt-P)\r
- *     ZC_HKEY_RECORD (Alt-R)\r
- *     ZC_HKEY_SEED (Alt-S)\r
- *     ZC_HKEY_UNDO (Alt-U)\r
- *     ZC_HKEY_RESTART (Alt-N, "new game")\r
- *     ZC_HKEY_QUIT (Alt-X, "exit game")\r
- *     ZC_HKEY_DEBUG (Alt-D)\r
- *     ZC_HKEY_HELP (Alt-H)\r
- *\r
- * If the timeout argument is not zero, the input gets interrupted\r
- * after timeout/10 seconds (and the return value is 0).\r
- *\r
- * The complete input line including the cursor must fit in "width"\r
- * screen units.\r
- *\r
- * The function may be called once again to continue after timeouts,\r
- * misplaced mouse clicks or hot keys. In this case the "continued"\r
- * flag will be set. This information can be useful if the interface\r
- * implements input line history.\r
- *\r
- * The screen is not scrolled after the return key was pressed. The\r
- * cursor is at the end of the input line when the function returns.\r
- *\r
- * Since Frotz 2.2 the helper function "completion" can be called\r
- * to implement word completion (similar to tcsh under Unix).\r
- *\r
- */\r
-zchar os_read_line(int max, zchar *buf, int timeout, int width, int continued)\r
-{\r
-    static int pos = 0, searchpos = -1;\r
-    int ptx,pty;\r
-    int len = mywcslen(buf);\r
-    SF_textsetting * ts = sf_curtextsetting();\r
-    SDL_Event event;\r
-\r
-    //printf("os_read_line mx%d buf[0]%d tm%d w%d c%d\n",max,buf[0],timeout,width,continued);\r
-    // LineInput line;\r
-    sf_flushtext();\r
-    // theWnd->ResetOverhang();\r
-    // theWnd->UpdateMenus();\r
-    // theWnd->RecaseInput(buf);\r
-\r
-    /* Better be careful here or it might segv.  I wonder if we should just\r
-       ignore 'continued' and check for len > 0 instead?  Might work better\r
-       with Beyond Zork. */\r
-    if (!continued || pos > len || searchpos > len) {\r
-        pos = len;\r
-        gen_history_reset();    /* Reset user's history view. */\r
-        searchpos = -1;         /* -1 means initialize from len. */\r
-    }\r
-\r
-    // Draw the input line\r
-    ptx = ts->cx;\r
-    pty = ts->cy;\r
-    // CPoint point = theWnd->GetTextPoint();\r
-    ptx -= os_string_width(buf);       //theWnd->GetTextWidth(buf,mywcslen(buf));\r
-    sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-\r
-    if (timeout) mytimeout = sf_ticks() + m_timerinterval*timeout;\r
-    // InputTimer timer(timeout);\r
-    while (true) {\r
-        // Get the next input\r
-        while (SDL_PollEvent(&event)) {\r
-            zword c;\r
-            if ((c = goodzkey(&event,1))) {\r
-                //printf("goodzk %4x\n",c);\r
-                switch (c) {\r
-                case ZC_BACKSPACE:\r
-                    // Delete the character to the left of the cursor\r
-                    if (pos > 0) {\r
-                        memmove(buf+pos-1,buf+pos,sizeof(zword)*(mywcslen(buf)-pos+1));\r
-                        pos--;\r
-                        sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                    }\r
-                    continue;\r
-                case ZC_ESCAPE:         /* Delete whole line */\r
-                    pos = 0;\r
-                    buf[0] = '\0';\r
-                    searchpos = -1;\r
-                    gen_history_reset();\r
-                    sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                    continue;\r
-                case VK_TAB:\r
-                    if (pos == (int)mywcslen(buf)) {\r
-                        zchar extension[10], *s;\r
-                        completion(buf,extension);\r
-\r
-                        // Add the completion to the input stream\r
-                        for (s = extension; *s != 0; s++)\r
-                            if (sf_IsValidChar(*s))\r
-                                buf[pos++] = (*s);\r
-                        buf[pos] = 0;\r
-                        sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                    }\r
-                    continue;\r
-                case ZC_ARROW_LEFT:\r
-                    // Move the cursor left\r
-                    if (pos > 0)\r
-                        pos--;\r
-                    sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                    continue;\r
-                case ZC_ARROW_RIGHT:\r
-                    // Move the cursor right\r
-                    if (pos < (int)mywcslen(buf))\r
-                        pos++;\r
-                    sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                    continue;\r
-                case ZC_ARROW_UP:\r
-                case ZC_ARROW_DOWN:\r
-                    if (searchpos < 0)\r
-                        searchpos = mywcslen(buf);\r
-                    if ((c == ZC_ARROW_UP\r
-                         ? gen_history_back : gen_history_forward)(\r
-                                 buf, searchpos, max)) {\r
-                        pos = mywcslen(buf);\r
-                        sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                    }\r
-                    continue;\r
-                /* Pass through as up/down arrows for Beyond Zork. */\r
-                case VK_PAGE_UP: c = ZC_ARROW_UP; break;\r
-                case VK_PAGE_DOWN: c = ZC_ARROW_DOWN; break;\r
-                default:\r
-                    if (sf_IsValidChar(c) && mywcslen(buf) < max) {\r
-                        // Add a valid character to the input line\r
-                        // Get the width of the new input line\r
-                        int len = os_string_width(buf);\r
-                        len += os_char_width(c);\r
-                        len += os_char_width('0');\r
-\r
-                        //printf("l%d w%d p%d\n",len,width,pos);\r
-                        // Only allow if the width limit is not exceeded\r
-                        if (len <= width) {\r
-                            memmove(buf+pos+1,buf+pos,sizeof(zword)*(mywcslen(buf)-pos+1));\r
-                            *(buf+pos) = c;\r
-                            pos++;\r
-                            sf_DrawInput(buf,pos,ptx,pty,width,true);\r
-                        }\r
-                        continue;\r
-                    }\r
-                }\r
-                if (is_terminator(c)) {\r
-                    // Terminate the current input\r
-                    m_exitPause = false;\r
-                    sf_DrawInput(buf,pos,ptx,pty,width,false);\r
-\r
-                    if ((c == ZC_SINGLE_CLICK) || (c == ZC_DOUBLE_CLICK)) {\r
-                        /*  mouse_x = input.mousex+1;\r
-                                                mouse_y = input.mousey+1;*/\r
-                    } else if (c == ZC_RETURN)\r
-                        gen_add_to_history(buf);\r
-                    //                      theWnd->SetLastInput(buf);\r
-                    return c;\r
-                }\r
-            }\r
-        }\r
-        if ((timeout) && (sf_ticks() >= mytimeout)) {\r
-            return ZC_TIME_OUT;\r
-        }\r
-        sf_checksound();\r
-        sf_sleep(10);\r
-    }\r
-\r
-    return 0;\r
-}\r
-\r
-// Draw the current input line\r
-void sf_DrawInput(zchar * buffer, int pos, int ptx, int pty, int width, bool cursor)\r
-  {\r
-  int height;\r
-  SF_textsetting * ts = sf_curtextsetting();\r
-\r
-//printf("DrawInput (%d)[%d] %d x%d y%d w%d %d\n",mywcslen(buffer),os_string_width(buffer),pos,ptx,pty,width,cursor);\r
-\r
-  height = ts->font->height(ts->font);\r
-\r
-       // Remove any previous input\r
-  sf_fillrect(ts->back,ptx,pty,width,height);\r
-\r
-       // Display the input\r
-//  sf_pushtextsettings();\r
-  ts->cx = ptx; ts->cy = pty;\r
-  os_display_string(buffer);\r
-\r
-  if (cursor)\r
-       {\r
-       int wid=0, i=0, oh;\r
-       while (i<pos) wid += sf_charwidth(buffer[i++], &oh);\r
-       drawthecursor(ptx+wid,pty,1);\r
-       }\r
-\r
-//  sf_poptextsettings();\r
-/*\r
-       SetTextPoint(point);\r
-       WriteText(buffer,mywcslen(buffer));\r
-\r
-       if (cursor)\r
-       {\r
-               int x = point.x + GetTextWidth(buffer,pos);\r
-               int cx = GetCharWidth('0');\r
-               if (*(buffer+pos) != 0)\r
-                       cx = GetCharWidth(*(buffer+pos));\r
-\r
-               // Invert colours\r
-               COLORREF fore = m_dc.GetTextColor();\r
-               m_dc.SetTextColor(m_dc.GetBkColor());\r
-               m_dc.SetBkColor(fore);\r
-\r
-               // Draw a cursor\r
-               m_dc.MoveTo(x,point.y);\r
-               CRect rect(x,point.y,x+cx,point.y+height);\r
-               if (*(buffer+pos) != 0)\r
-                       ::ExtTextOutW(m_dc.GetSafeHdc(),0,0,ETO_OPAQUE,rect,buffer+pos,1,NULL);\r
-               else\r
-                       ::ExtTextOutW(m_dc.GetSafeHdc(),0,0,ETO_OPAQUE,rect,NULL,0,NULL);\r
-\r
-               // Put colours back\r
-               m_dc.SetBkColor(m_dc.GetTextColor());\r
-               m_dc.SetTextColor(fore);\r
-       }*/\r
-\r
-       // Update the window\r
-  sf_flushdisplay();\r
-//     Invalidate();\r
-  }\r
-\r
-\r
-/*\r
- * os_read_mouse\r
- *\r
- * Store the mouse position in the global variables "mouse_x" and\r
- * "mouse_y", the code of the last clicked menu in "menu_selected"\r
- * and return the mouse buttons currently pressed.\r
- *\r
- */\r
-zword os_read_mouse(void)\r
-  {\r
-  byte c; int x, y; zword btn = 0;\r
-       // Get the mouse position\r
-  SDL_PumpEvents();\r
-  c = SDL_GetMouseState(&x,&y);\r
-  mouse_x = x+1-blitrect.x;\r
-  mouse_y = y+1-blitrect.y;\r
-       // Get the last selected menu item\r
-//     menu_selected = theWnd->GetMenuClick();\r
-//printf("%04x\n",c);\r
-       // Get the mouse buttons\r
-  if (c & SDL_BUTTON_LMASK)\r
-       btn |= 1;\r
-  if (c & SDL_BUTTON_RMASK)\r
-       btn |= 2;\r
-  if (c & SDL_BUTTON_MMASK)\r
-       btn |= 4;\r
-\r
-  return btn;\r
-  }\r
-\r
-/*\r
- * os_more_prompt\r
- *\r
- * Display a MORE prompt, wait for a keypress and remove the MORE\r
- * prompt from the screen.\r
- *\r
- */\r
-void os_more_prompt(void)\r
-  {\r
-  if (m_morePrompts)\r
-       {\r
-       SF_textsetting * ts; int x,y,h;\r
-       const char *p = sf_msgstring(IDS_MORE);\r
-       sf_flushtext();\r
-//             theWnd->ResetOverhang();\r
-\r
-               // Save the current text position\r
-       sf_pushtextsettings();\r
-       ts = sf_curtextsetting();\r
-       x = ts->cx; y = ts->cy;\r
-       h = ts->font->height(ts->font);\r
-               // Show a [More] prompt\r
-       while (*p) os_display_char((zword)(*p++));\r
-//             theWnd->WriteText(CResString(IDS_MORE));\r
-//     sf_drawcursor(true);\r
-//     sf_flushdisplay();\r
-\r
-               // Wait for a key press\r
-       os_read_key(0,1);\r
-               // Remove the [More] prompt\r
-       sf_fillrect(ts->back,x,y,ts->cx-x,h);\r
-//     sf_drawcursor(false);\r
-\r
-               // Restore the current text position\r
-       sf_poptextsettings();\r
-       }\r
-}\r
-\r
-ulong * sf_savearea( int x, int y, int w, int h)\r
-  {\r
-  ulong *r, *p, *s; int i;\r
-\r
-  if (x < 0){ w += x; x = 0;}\r
-  if (x+w > ewidth) w = ewidth-x;\r
-  if (w <= 0) return NULL;\r
-\r
-  if (y < 0){ h += y; y = 0;}\r
-  if (y+h > eheight) h = eheight-y;\r
-  if (h <= 0) return NULL;\r
-\r
-  r = p = malloc((w*h+4)*sizeof(ulong));\r
-  if (!r) return NULL;\r
-\r
-  *p++ = x;\r
-  *p++ = y;\r
-  *p++ = w;\r
-  *p++ = h;\r
-\r
-  s = sbuffer+x+y*sbpitch;\r
-  for (i=0;i<h;i++)\r
-       {\r
-       memcpy(p,s,w*sizeof(ulong));\r
-       p += w;\r
-       s += sbpitch;\r
-       }\r
-// printf("savearea %d %d %d %d\n",x,y,w,h); fflush(stdout);\r
-  return r;\r
-  }\r
-\r
-void sf_restoreareaandfree( ulong *s)\r
-  {\r
-  ulong *p, *d; int i,x,y,w,h;\r
-  if (!s) return;\r
-\r
-  p = s;\r
-  x = *p++;\r
-  y = *p++;\r
-  w = *p++;\r
-  h = *p++;\r
-// printf("restorearea %d %d %d %d\n",x,y,w,h); fflush(stdout);\r
-\r
-  d = sbuffer+x+y*sbpitch;\r
-  for (i=0;i<h;i++)\r
-       {\r
-       memcpy(d,p,w*sizeof(ulong));\r
-       p += w;\r
-       d += sbpitch;\r
-       }\r
-\r
-  free(s);\r
-  dirty = 1;\r
-  sf_flushdisplay();\r
-  }\r
-\r
-int (*sf_osdialog)( bool ex, const char *def, const char *filt, const char *tit, char **res,\r
-       ulong *sbuf, int sbp, int ew, int eh, int isfull) = NULL;\r
-\r
-int sf_user_fdialog( bool existing, const char *defaultname, const char *filter, const char *title,\r
-       char **result)\r
-  {\r
-  if (sf_osdialog) return sf_osdialog(existing,defaultname,filter,title,result,\r
-                       sbuffer, sbpitch, ewidth, eheight, isfullscreen);\r
-  return SF_NOTIMP;\r
-  }\r
-\r
-void sf_videodata( ulong **sb, int *sp, int *ew, int *eh)\r
-  {\r
-  *sb = sbuffer;\r
-  *sp = sbpitch;\r
-  *ew = ewidth;\r
-  *eh = eheight;\r
-  }\r
-\r
-extern zword sf_yesnooverlay( int xc, int yc, char *t, int sr);\r
-static void sf_quitconf()\r
-  {\r
-  if (sf_yesnooverlay(ewidth/2,eheight/2,"Quit: are you sure?",1)==ZC_RETURN)\r
-       {\r
-       printf("\n\nQuitting (close button clicked on main window)\n\n");\r
-       SDL_Quit();\r
-       exit(0);\r
-       }\r
-  }\r
-\r
-void os_check_events(void)\r
-  {\r
-  SDL_Event event;\r
-  SDL_PumpEvents();\r
-  if (SDL_PeepEvents(&event,1,SDL_GETEVENT,SDL_QUITMASK))\r
-       sf_quitconf();\r
-  }\r
-\r
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+//#include <signal.h>
+
+//#define STATIC
+
+#include <SDL.h>
+
+#include "generic.h"
+
+#include "../common/defines.h"
+#include "sf_frotz.h"
+
+static SDL_Rect blitrect = {0,0,0,0};
+static char banner[256];
+static int isfullscreen;
+static ulong *sbuffer = NULL;
+static int sbpitch;            // in longs
+static int dirty = 0;
+static int bitsperpixel = 32;
+static int RBswap = 0;
+static int ewidth, eheight;
+static SDL_Surface *screen, *off = NULL;
+static int mustlockscreen = 0;
+int m_timerinterval = 100;
+
+static void sf_quitconf();
+
+// clipping region
+static int xmin,xmax,ymin,ymax;
+
+void sf_setclip( int x, int y, int w, int h)
+  {
+  if (x < 0){ w += x; x = 0;}
+  if (x+w > ewidth) w = ewidth-x;
+  if (y < 0){ h += y; y = 0;}
+  if (y+h > eheight) h = eheight-y;
+  xmin = x; xmax = x+w;
+  ymin = y; ymax = y+h;
+  }
+
+void sf_getclip( int *x, int *y, int *w, int *h)
+  {
+  *x = xmin; *y = ymin;
+  *w = xmax-xmin; *h = ymax-ymin;
+  }
+
+static int mywcslen( zchar *b)
+  {
+  int n=0;
+  while (*b++) n++;
+  return n;
+  }
+
+static void myGrefresh(){
+  if (off) {
+    if (mustlockscreen) SDL_LockSurface(screen);
+    SDL_BlitSurface(off,NULL,screen,&blitrect);
+    if (mustlockscreen) SDL_UnlockSurface(screen);
+    }
+  SDL_UpdateRect(screen,0,0,0,0);
+  }
+
+void sf_wpixel( int x, int y, ulong c)
+  {
+  if (x < xmin || x >= xmax || y < ymin || y >= ymax) return;
+  sbuffer[x+sbpitch*y] = c;
+  dirty = 1;
+  }
+
+ulong sf_rpixel( int x, int y)
+  {
+  if (x < 0 || x >= ewidth || y < 0 || y >= eheight) return 0;
+  return sbuffer[x+sbpitch*y];
+  }
+
+#define MAXCUR 64
+static ulong savedcur[MAXCUR];
+
+static void drawthecursor( int x, int y, int onoff)
+  {
+  SF_textsetting * ts = sf_curtextsetting();
+  int i, h = ts->font->height(ts->font);
+  if (h > MAXCUR) h = MAXCUR;
+  if (onoff)
+       {
+       for (i=0;i<h;i++) 
+               {
+               savedcur[i] = sf_rpixel(x,y+i);
+               sf_wpixel(x,y+i,ts->fore);
+               }
+       }
+  else
+       {
+       for (i=0;i<h;i++) 
+               {
+               sf_wpixel(x,y+i,savedcur[i]);
+               }
+       }
+  }
+
+bool sf_IsValidChar(unsigned short c)
+  {
+  if (c >= ZC_ASCII_MIN && c <= ZC_ASCII_MAX)
+       return true;
+  if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX)
+       return true;
+  if (c >= 0x100)
+       return true;
+  return false;
+  }
+
+void sf_drawcursor( bool c)
+  {
+  SF_textsetting * ts = sf_curtextsetting();
+  drawthecursor(ts->cx,ts->cy,c);
+  }
+
+void sf_chline( int x, int y, ulong c, int n)
+  {
+  ulong *s;
+  if (y < ymin || y >= ymax) return;
+  if (x < xmin){ n += x-xmin; x = xmin;}
+  if (x+n > xmax) n = xmax-x;
+  if (n <= 0) return;
+  s = sbuffer+x+sbpitch*y;
+  while (n--) *s++ = c;
+  dirty = 1;
+  }
+
+void sf_cvline( int x, int y, ulong c, int n)
+  {
+  ulong *s;
+  if (x < xmin || x >= xmax) return;
+  if (y < xmin){ n += y-ymin; y = ymin;}
+  if (y+n > ymax) n = ymax-y;
+  if (n <= 0) return;
+  s = sbuffer+x+sbpitch*y;
+  while (n--) { *s = c; s += sbpitch;}
+  dirty = 1;
+  }
+
+
+ulong sf_blendlinear( int a, ulong s, ulong d){
+  ulong r;
+  r = ((s & 0xff)*a + (d & 0xff)*(256-a))>>8;
+  s >>= 8; d >>= 8;
+  r |= (((s & 0xff)*a + (d & 0xff)*(256-a))>>8)<<8;
+  s >>= 8; d >>= 8;
+  r |= (((s & 0xff)*a + (d & 0xff)*(256-a))>>8)<<16;
+  return r;
+  }
+
+void sf_writeglyph( SF_glyph *g)
+  {
+  SF_textsetting *ts = sf_curtextsetting();
+
+  int i,j,m;
+
+  int w = g->dx;
+  int weff = g->xof+g->w;
+  byte * bmp = (byte *)(&(g->bitmap[0]));
+  int h = g->h;
+  int nby = (g->w+7)/8;
+  int byw = g->w;
+
+  int x = ts->cx;
+  int y = ts->cy;
+
+  int dxpre = g->xof;
+  int dypre = ts->font->ascent(ts->font)-h-(int)g->yof;
+
+  int height = ts->font->height(ts->font);
+  int width;
+
+  ulong color, bc;
+
+  if ((ts->style & REVERSE_STYLE) != 0)
+       {
+       bc = ts->fore;
+       color = ts->back;
+       }
+  else
+       {
+       color = ts->fore;
+       bc = ts->back;
+       }
+
+       // compute size and position of background rect
+
+  if (weff < w) weff = w;
+  width = weff - ts->oh;
+  if ((width > 0) && (ts->backTransparent == 0))
+       sf_fillrect(bc,x+ts->oh,y,width,height);
+
+  x += dxpre;
+  y += dypre;
+
+//printf("\n");
+  for (i=0;i<h;i++)
+    {
+    int xx = 0;
+    if (ts->font->antialiased)
+      for (m=0;m<byw;m++)
+       {
+       int t = *bmp++;
+       if (xx < byw)
+           {
+           if (t)
+               {
+               ulong sval = color;
+               if (t < 255)
+                 sval = sf_blend((int)(t + (t>>7)),sval,sf_rpixel(x+xx,y));
+               sf_wpixel( x+xx, y, sval);
+               }
+           }
+       xx++;
+       }
+    else
+      for (m=0;m<nby;m++)
+       {
+       int t = *bmp++;
+       for (j=0;j<8;j++, t *= 2)
+         {
+         if (xx < byw)
+           {
+           if (t & 0x80)
+               sf_wpixel( x+xx, y, color);
+           }
+         xx++;
+         }
+       }
+    y++;
+    }
+
+  ts->cx += (w);
+  ts->oh = (weff > w) ? weff-w : 0;
+  }
+
+
+void sf_fillrect( unsigned long color, int x, int y, int w, int h)
+  {
+  ulong *dst;
+  int i;
+//printf("fillrect %x %d %d %d %d\n",color,x,y,w,h);
+//printf("dst%p sbpitch%d\n",dst,sbpitch);
+  if (x < xmin){ w += x-xmin; x = xmin;}
+  if (x+w > xmax) w = xmax-x;
+  if (w <= 0) return;
+  if (y < ymin){ h += y-ymin; y = ymin;}
+  if (y+h > ymax) h = ymax-y;
+  if (h <= 0) return;
+  dst = sbuffer+x+sbpitch*y;
+  while (h--)
+       {
+       for (i=0;i<w;i++) dst[i] = color;
+       dst += sbpitch;
+       }
+  dirty = 1;
+  }
+
+void sf_rect( unsigned long color, int x, int y, int w, int h)
+  {
+  sf_chline(x,y,color,w);
+  sf_chline(x,y+h-1,color,w);
+  sf_cvline(x,y,color,h);
+  sf_cvline(x+w-1,y,color,h);
+  }
+
+
+void sf_flushtext()
+  {
+  SF_textsetting *ts = sf_curtextsetting();
+  ts->cx += ts->oh;
+  ts->oh = 0;
+  }
+
+/*
+ * os_erase_area
+ *
+ * Fill a rectangular area of the screen with the current background
+ * colour. Top left coordinates are (1,1). The cursor does not move.
+ *
+ * The final argument gives the window being changed, -1 if only a
+ * portion of a window is being erased, or -2 if the whole screen is
+ * being erased.
+ *
+ */
+void os_erase_area(int top, int left, int bottom, int right, int win)
+  {
+  sf_flushtext();
+  sf_fillrect((sf_curtextsetting())->back,left-1,top-1,right-left+1,bottom-top+1);
+//     theWnd->FillBackground(CRect(left-1,top-1,right,bottom));
+  }
+
+/*
+ * os_peek_colour
+ *
+ * Return the colour of the screen unit below the cursor. (If the
+ * interface uses a text mode, it may return the background colour
+ * of the character at the cursor position instead.) This is used
+ * when text is printed on top of pictures. Note that this coulor
+ * need not be in the standard set of Z-machine colours. To handle
+ * this situation, Frotz entends the colour scheme: Colours above
+ * 15 (and below 256) may be used by the interface to refer to non
+ * standard colours. Of course, os_set_colour must be able to deal
+ * with these colours.
+ *
+ */
+int os_peek_colour(void)
+  {
+  SF_textsetting *ts = sf_curtextsetting();
+  sf_flushtext();
+  return sf_GetColourIndex(sf_rpixel(ts->cx,ts->cy));
+  }
+
+static void scroll( int x, int y, int w, int h, int n)
+  {
+  ulong *src, *dst;
+  int nmove, step;
+  if (n > 0)
+       {
+       dst = sbuffer+x+sbpitch*y;
+       src = dst + n*sbpitch;
+       nmove = h-n;
+       step = sbpitch;
+       }
+  else if (n < 0)
+       {
+       n = -n;
+       nmove = h-n;
+       step = -sbpitch;
+       src = sbuffer+x+sbpitch*(y+nmove-1);
+       dst = src + n*sbpitch;
+       }
+  else
+       return;
+  if (nmove > 0)
+    {
+    while (nmove--)
+       {
+       memcpy(dst,src,w*sizeof(ulong));
+       dst += step;
+       src += step;
+       }
+    dirty = 1;
+    }
+  }
+
+void sf_flushdisplay()
+  {
+  if (dirty) myGrefresh();
+  dirty = 0;
+  }
+
+/*
+ * os_scroll_area
+ *
+ * Scroll a rectangular area of the screen up (units > 0) or down
+ * (units < 0) and fill the empty space with the current background
+ * colour. Top left coordinates are (1,1). The cursor stays put.
+ *
+ */
+void os_scroll_area(int top, int left, int bottom, int right, int units)
+  {
+  sf_flushtext();
+//     theWnd->ResetOverhang();
+
+  scroll(left-1,top-1,right-left+1,bottom-top+1,units);
+  if (units > 0)
+       sf_fillrect((sf_curtextsetting())->back,left-1,bottom-units,right-left+1,units);
+  else if (units < 0)
+       sf_fillrect((sf_curtextsetting())->back,left-1,top-1,right-left+1,units);
+
+//  if (theApp.GetFastScrolling() == false)
+//  sf_flushdisplay();
+//             theWnd->FlushDisplay();
+  }
+
+bool os_repaint_window(int win, int ypos_old, int ypos_new, int xpos,
+                       int ysize, int xsize)
+{
+    //TODO
+    return FALSE;
+}
+
+
+int SFdticks = 200;
+volatile bool SFticked = 0;
+static SDL_TimerID timerid = 0;
+
+static Uint32 mytimer( Uint32 inter, void *parm)
+  {
+  SFticked = true;
+  return inter;
+  }
+
+static void cleanvideo()
+  {
+  if (timerid) SDL_RemoveTimer(timerid);
+  SDL_Quit();
+  }
+
+#define RM 0x0000ff
+#define GM 0x00ff00
+#define BM 0xff0000
+
+static int check( int R, int G, int B){
+  if (R==RM && G==GM && B==BM) return 0;
+  if (R==BM && G==GM && B==RM) return -1;
+  return 1;
+  }
+
+extern char stripped_story_name[];
+
+void sf_initvideo( int W, int H, int full)
+  {
+  int desired_bpp, needoff, reqW, reqH;
+  Uint32 video_flags;
+  SDL_PixelFormat *format;
+  Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER |
+       SDL_INIT_AUDIO;
+
+  sprintf(banner,"SDL Frotz v%s - %s (z%d)",VERSION,
+       f_setup.story_name,h_version);
+  desired_bpp = 32;
+  video_flags = 0;
+
+  if ( SDL_Init(initflags) < 0 ) {
+       os_fatal("Couldn't initialize SDL: %s", SDL_GetError());
+       }
+
+  CLEANREG(cleanvideo);
+
+  isfullscreen = full;
+  if (full) video_flags = SDL_FULLSCREEN;
+  reqW = W; reqH = H;
+  if (full)
+       {
+       if (m_reqW == -1)
+               {
+               const SDL_VideoInfo * v = SDL_GetVideoInfo();
+               if (v) { m_reqW = v->current_w; m_reqH = v->current_h;}
+               }
+       if (m_reqW > reqW) reqW = m_reqW;
+       if (m_reqH > reqH) reqH = m_reqH;
+       }
+  screen = SDL_SetVideoMode( reqW, reqH, desired_bpp, video_flags);
+  if ( screen == NULL ) {
+       os_fatal("Couldn't set %dx%dx%d video mode: %s",
+               reqW, reqH, desired_bpp, SDL_GetError());
+       }
+  SDL_WM_SetCaption(banner,NULL);
+  bitsperpixel = 32;
+
+  mustlockscreen = SDL_MUSTLOCK(screen);
+  format = screen->format;
+
+  needoff = (mustlockscreen) || (screen->w != W) || (screen->h != H) ||
+       (format->BitsPerPixel != 24) ||
+       (screen->pitch != 3*W);
+
+  RBswap = 0;
+  if (!needoff) {
+    needoff = check(format->Rmask,format->Gmask,format->Bmask);
+    if ((needoff == -1)){
+       RBswap = 1;
+       needoff = 0;
+       }
+    else
+       needoff = 1;
+    }
+// printf("setvideo: gm %dx%d rq %dx%d(f%d) got %dx%d needoff %d\n", W,H,reqW,reqH,full,screen->w,screen->h,needoff);
+
+  if (needoff) {
+    sbuffer = calloc(W*H,sizeof(ulong));
+    if (!sbuffer){
+       os_fatal("Could not create gc");
+       }
+    off = SDL_CreateRGBSurfaceFrom(sbuffer,
+       W,H,32,4*W,0xff,0xff00,0xff0000,0);
+//     off = SDL_CreateRGBSurfaceFrom(sbuffer,
+//     W,H,32,4*screen->w,0xff,0xff00,0xff0000,0);
+    if (!off){
+       os_fatal("Could not create offscreen surface");
+       }
+    }
+  else {
+    sbuffer = (ulong *)screen->pixels;
+    }
+
+  blitrect.w = W; blitrect.h = H;
+  blitrect.x = (screen->w - W)/2;
+  blitrect.y = (screen->h - H)/2;
+  SDL_EnableUNICODE(1);
+  SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+
+  SDL_AddTimer(SFdticks,mytimer,NULL);
+
+  xmin = ymin = 0;
+  xmax = ewidth = W;
+  ymax = eheight = H;
+  sbpitch = W;
+  dirty = 1;
+  }
+
+/*
+ * os_draw_picture
+ *
+ * Display a picture at the given coordinates.
+ *
+ */
+void os_draw_picture(int picture, int y, int x)
+  {
+  int ew, eh, xx, yy, ix, iy, d;
+  int ox, oy, ow, oh;
+  Zwindow * winpars;
+  sf_picture * pic = sf_getpic(picture);
+  ulong *src, *dst, sval, dval, alpha;
+
+  sf_flushtext();
+
+  if (!pic) return;
+  if (!pic->pixels) return;    // TODO: rect
+  src = (ulong *) pic->pixels;
+
+  x--; y--;
+  ew = m_gfxScale*pic->width;
+  eh = m_gfxScale*pic->height;
+
+       // this takes care of the fact taht x, y are really 16 bit values
+  if (x & 0x8000) x |= 0xffff0000;
+  if (y & 0x8000) y |= 0xffff0000;
+
+       // get current window rect
+  sf_getclip(&ox,&oy,&ow,&oh);
+  winpars = curwinrec();
+  sf_setclip( winpars->x_pos-1, winpars->y_pos-1, winpars->x_size, winpars->y_size);
+
+       // clip taking into account possible origin
+       // outside the clipping rect
+  if (x < xmin) { d = xmin-x; ew -= d; x = xmin; src += d;}
+  if (x+ew > xmax) ew = xmax - x;
+  ew /= m_gfxScale;
+
+  if (y < ymin) { d = ymin-y; eh -= d; y = ymin; src += d*pic->width;}
+  if (y+eh > ymax) eh = ymax-y;
+  eh /= m_gfxScale;
+
+  sf_setclip(ox,oy,ow,oh);
+
+  if (ew <= 0) return;
+  if (eh <= 0) return;
+
+  for (yy=0;yy<eh;yy++)
+    {
+    for (xx=0;xx<ew;xx++)
+       {
+       dst = sbuffer + x +xx*m_gfxScale + sbpitch*(y + yy*m_gfxScale);
+       sval = src[xx];
+       alpha = (sval >> 24);
+       if (alpha == 255)
+               dval = sval & 0xffffff;
+       else
+               dval = sf_blend((int)(alpha + (alpha>>7)),sval,dst[0]);
+       for (iy=0;iy<m_gfxScale;iy++)
+         {
+         for (ix=0;ix<m_gfxScale;ix++) dst[ix] = dval;
+         dst += sbpitch;
+         }
+       }
+    src += pic->width;
+    }
+
+  dirty = 1;
+  }
+
+static ulong mytimeout;
+int mouse_button;
+static int numAltQ = 0;
+
+static zword goodzkey( SDL_Event *e, int allowed)
+  {
+  zword c;
+  if (e->type == SDL_QUIT)
+       {
+       sf_quitconf();
+//     if (allowed) return ZC_HKEY_QUIT;
+       return 0;
+       }
+  if (e->type == SDL_MOUSEBUTTONDOWN)
+       {
+//printf("down %d\n",e->button.button);
+       if (true)       //(e->button.button == SDL_BUTTON_LEFT)
+               {
+               mouse_button = e->button.button;
+               mouse_x = e->button.x+1-blitrect.x;
+               mouse_y = e->button.y+1-blitrect.y;
+               return ZC_SINGLE_CLICK;
+               }
+       return 0;
+       }
+  if (e->type != SDL_KEYDOWN) return 0;
+       // emergency exit
+  if (((e->key.keysym.mod & 0xfff) == (KMOD_LALT | KMOD_LCTRL)) && (e->key.keysym.sym == 'x'))
+       os_fatal("Emergency exit!\n\n(Control-Alt-X pressed)");
+  if (((e->key.keysym.mod & KMOD_LALT) == KMOD_LALT) ||
+       ((e->key.keysym.mod & KMOD_RALT) == KMOD_RALT))
+       {
+       if (e->key.keysym.sym == 'q')
+               {
+               numAltQ++;
+               if (numAltQ > 2)
+                       os_fatal("Emergency exit!\n\n(Alt-Q pressed 3 times in succession)");
+               }
+       else numAltQ = 0;
+       if (!allowed) return 0;
+       switch (e->key.keysym.sym)
+         {
+         case 'x': return ZC_HKEY_QUIT;
+         case 'p': return ZC_HKEY_PLAYBACK;
+         case 'r': return ZC_HKEY_RECORD;
+         case 's': return ZC_HKEY_SEED;
+         case 'u': return ZC_HKEY_UNDO;
+         case 'n': return ZC_HKEY_RESTART;
+         case 'd': return ZC_HKEY_DEBUG;
+         case 'h': return ZC_HKEY_HELP;
+         default: return 0;
+         }
+       }
+  else numAltQ = 0;
+  switch (e->key.keysym.sym)
+       {
+       case SDLK_INSERT:       return (allowed ? VK_INS : 0);
+       case SDLK_BACKSPACE:    return ZC_BACKSPACE;
+       case SDLK_ESCAPE:       return ZC_ESCAPE;
+       case SDLK_RETURN:       return ZC_RETURN;
+       case SDLK_UP:           return ZC_ARROW_UP;
+       case SDLK_DOWN:         return ZC_ARROW_DOWN;
+       case SDLK_LEFT:         return ZC_ARROW_LEFT;
+       case SDLK_RIGHT:        return ZC_ARROW_RIGHT;
+       case SDLK_TAB:          return (allowed ? VK_TAB : 0);
+       case SDLK_PAGEUP:       return (allowed ? VK_PAGE_UP : 0);
+       case SDLK_PAGEDOWN:     return (allowed ? VK_PAGE_DOWN : 0);
+       case SDLK_KP0:          return ZC_NUMPAD_MIN+0;
+       case SDLK_KP1:          return ZC_NUMPAD_MIN+1;
+       case SDLK_KP2:          return ZC_NUMPAD_MIN+2;
+       case SDLK_KP3:          return ZC_NUMPAD_MIN+3;
+       case SDLK_KP4:          return ZC_NUMPAD_MIN+4;
+       case SDLK_KP5:          return ZC_NUMPAD_MIN+5;
+       case SDLK_KP6:          return ZC_NUMPAD_MIN+6;
+       case SDLK_KP7:          return ZC_NUMPAD_MIN+7;
+       case SDLK_KP8:          return ZC_NUMPAD_MIN+8;
+       case SDLK_KP9:          return ZC_NUMPAD_MIN+9;
+       case SDLK_F1:           return ZC_FKEY_MIN+0;
+       case SDLK_F2:           return ZC_FKEY_MIN+1;
+       case SDLK_F3:           return ZC_FKEY_MIN+2;
+       case SDLK_F4:           return ZC_FKEY_MIN+3;
+       case SDLK_F5:           return ZC_FKEY_MIN+4;
+       case SDLK_F6:           return ZC_FKEY_MIN+5;
+       case SDLK_F7:           return ZC_FKEY_MIN+6;
+       case SDLK_F8:           return ZC_FKEY_MIN+7;
+       case SDLK_F9:           return ZC_FKEY_MIN+8;
+       case SDLK_F10:          return ZC_FKEY_MIN+9;
+       case SDLK_F11:          return ZC_FKEY_MIN+10;
+       case SDLK_F12:          return ZC_FKEY_MIN+11;
+       default: break;
+       }
+  c = e->key.keysym.unicode;
+  if ((c >= 32 && c <= 126) || (c >= 160)) return c;
+  return 0;
+  }
+
+zword sf_read_key( int timeout, int cursor, int allowed)
+  {
+  SDL_Event event;
+  zword inch = 0;
+
+  sf_flushtext();
+//     theWnd->ResetOverhang();
+//     theWnd->UpdateMenus();
+  if (cursor)
+       sf_drawcursor(true);
+  sf_flushdisplay();
+
+  if (timeout) mytimeout = sf_ticks() + m_timerinterval*timeout;
+//     InputTimer timer(timeout);
+//     FrotzWnd::Input input;
+  while (true)
+    {
+               // Get the next input
+    while (SDL_PollEvent(&event)) 
+       {
+//if (event.type == SDL_QUIT) printf("got SDL_QUIT\n");
+       if ((inch = goodzkey(&event,allowed))) 
+               break;
+       }
+    if (inch) break;
+    if ((timeout) && (sf_ticks() >= mytimeout))
+       {
+       inch = ZC_TIME_OUT;
+       break;
+       }
+    sf_checksound();
+    sf_sleep(10);
+    }
+
+  if (cursor)
+       sf_drawcursor(false);
+
+  return inch;
+  }
+
+
+/*
+ * os_read_key
+ *
+ * Read a single character from the keyboard (or a mouse click) and
+ * return it. Input aborts after timeout/10 seconds.
+ *
+ */
+zchar os_read_key(int timeout, int cursor)
+  {
+  return sf_read_key(timeout,cursor,0);
+  }
+
+
+/*
+ * os_read_line
+ *
+ * Read a line of input from the keyboard into a buffer. The buffer
+ * may already be primed with some text. In this case, the "initial"
+ * text is already displayed on the screen. After the input action
+ * is complete, the function returns with the terminating key value.
+ * The length of the input should not exceed "max" characters plus
+ * an extra 0 terminator.
+ *
+ * Terminating keys are the return key (13) and all function keys
+ * (see the Specification of the Z-machine) which are accepted by
+ * the is_terminator function. Mouse clicks behave like function
+ * keys except that the mouse position is stored in global variables
+ * "mouse_x" and "mouse_y" (top left coordinates are (1,1)).
+ *
+ * Furthermore, Frotz introduces some special terminating keys:
+ *
+ *     ZC_HKEY_PLAYBACK (Alt-P)
+ *     ZC_HKEY_RECORD (Alt-R)
+ *     ZC_HKEY_SEED (Alt-S)
+ *     ZC_HKEY_UNDO (Alt-U)
+ *     ZC_HKEY_RESTART (Alt-N, "new game")
+ *     ZC_HKEY_QUIT (Alt-X, "exit game")
+ *     ZC_HKEY_DEBUG (Alt-D)
+ *     ZC_HKEY_HELP (Alt-H)
+ *
+ * If the timeout argument is not zero, the input gets interrupted
+ * after timeout/10 seconds (and the return value is 0).
+ *
+ * The complete input line including the cursor must fit in "width"
+ * screen units.
+ *
+ * The function may be called once again to continue after timeouts,
+ * misplaced mouse clicks or hot keys. In this case the "continued"
+ * flag will be set. This information can be useful if the interface
+ * implements input line history.
+ *
+ * The screen is not scrolled after the return key was pressed. The
+ * cursor is at the end of the input line when the function returns.
+ *
+ * Since Frotz 2.2 the helper function "completion" can be called
+ * to implement word completion (similar to tcsh under Unix).
+ *
+ */
+zchar os_read_line(int max, zchar *buf, int timeout, int width, int continued)
+{
+    static int pos = 0, searchpos = -1;
+    int ptx,pty;
+    int len = mywcslen(buf);
+    SF_textsetting * ts = sf_curtextsetting();
+    SDL_Event event;
+
+    //printf("os_read_line mx%d buf[0]%d tm%d w%d c%d\n",max,buf[0],timeout,width,continued);
+    // LineInput line;
+    sf_flushtext();
+    // theWnd->ResetOverhang();
+    // theWnd->UpdateMenus();
+    // theWnd->RecaseInput(buf);
+
+    /* Better be careful here or it might segv.  I wonder if we should just
+       ignore 'continued' and check for len > 0 instead?  Might work better
+       with Beyond Zork. */
+    if (!continued || pos > len || searchpos > len) {
+        pos = len;
+        gen_history_reset();    /* Reset user's history view. */
+        searchpos = -1;         /* -1 means initialize from len. */
+    }
+
+    // Draw the input line
+    ptx = ts->cx;
+    pty = ts->cy;
+    // CPoint point = theWnd->GetTextPoint();
+    ptx -= os_string_width(buf);       //theWnd->GetTextWidth(buf,mywcslen(buf));
+    sf_DrawInput(buf,pos,ptx,pty,width,true);
+
+    if (timeout) mytimeout = sf_ticks() + m_timerinterval*timeout;
+    // InputTimer timer(timeout);
+    while (true) {
+        // Get the next input
+        while (SDL_PollEvent(&event)) {
+            zword c;
+            if ((c = goodzkey(&event,1))) {
+                //printf("goodzk %4x\n",c);
+                switch (c) {
+                case ZC_BACKSPACE:
+                    // Delete the character to the left of the cursor
+                    if (pos > 0) {
+                        memmove(buf+pos-1,buf+pos,sizeof(zword)*(mywcslen(buf)-pos+1));
+                        pos--;
+                        sf_DrawInput(buf,pos,ptx,pty,width,true);
+                    }
+                    continue;
+                case ZC_ESCAPE:         /* Delete whole line */
+                    pos = 0;
+                    buf[0] = '\0';
+                    searchpos = -1;
+                    gen_history_reset();
+                    sf_DrawInput(buf,pos,ptx,pty,width,true);
+                    continue;
+                case VK_TAB:
+                    if (pos == (int)mywcslen(buf)) {
+                        zchar extension[10], *s;
+                        completion(buf,extension);
+
+                        // Add the completion to the input stream
+                        for (s = extension; *s != 0; s++)
+                            if (sf_IsValidChar(*s))
+                                buf[pos++] = (*s);
+                        buf[pos] = 0;
+                        sf_DrawInput(buf,pos,ptx,pty,width,true);
+                    }
+                    continue;
+                case ZC_ARROW_LEFT:
+                    // Move the cursor left
+                    if (pos > 0)
+                        pos--;
+                    sf_DrawInput(buf,pos,ptx,pty,width,true);
+                    continue;
+                case ZC_ARROW_RIGHT:
+                    // Move the cursor right
+                    if (pos < (int)mywcslen(buf))
+                        pos++;
+                    sf_DrawInput(buf,pos,ptx,pty,width,true);
+                    continue;
+                case ZC_ARROW_UP:
+                case ZC_ARROW_DOWN:
+                    if (searchpos < 0)
+                        searchpos = mywcslen(buf);
+                    if ((c == ZC_ARROW_UP
+                         ? gen_history_back : gen_history_forward)(
+                                 buf, searchpos, max)) {
+                        pos = mywcslen(buf);
+                        sf_DrawInput(buf,pos,ptx,pty,width,true);
+                    }
+                    continue;
+                /* Pass through as up/down arrows for Beyond Zork. */
+                case VK_PAGE_UP: c = ZC_ARROW_UP; break;
+                case VK_PAGE_DOWN: c = ZC_ARROW_DOWN; break;
+                default:
+                    if (sf_IsValidChar(c) && mywcslen(buf) < max) {
+                        // Add a valid character to the input line
+                        // Get the width of the new input line
+                        int len = os_string_width(buf);
+                        len += os_char_width(c);
+                        len += os_char_width('0');
+
+                        //printf("l%d w%d p%d\n",len,width,pos);
+                        // Only allow if the width limit is not exceeded
+                        if (len <= width) {
+                            memmove(buf+pos+1,buf+pos,sizeof(zword)*(mywcslen(buf)-pos+1));
+                            *(buf+pos) = c;
+                            pos++;
+                            sf_DrawInput(buf,pos,ptx,pty,width,true);
+                        }
+                        continue;
+                    }
+                }
+                if (is_terminator(c)) {
+                    // Terminate the current input
+                    m_exitPause = false;
+                    sf_DrawInput(buf,pos,ptx,pty,width,false);
+
+                    if ((c == ZC_SINGLE_CLICK) || (c == ZC_DOUBLE_CLICK)) {
+                        /*  mouse_x = input.mousex+1;
+                                                mouse_y = input.mousey+1;*/
+                    } else if (c == ZC_RETURN)
+                        gen_add_to_history(buf);
+                    //                      theWnd->SetLastInput(buf);
+                    return c;
+                }
+            }
+        }
+        if ((timeout) && (sf_ticks() >= mytimeout)) {
+            return ZC_TIME_OUT;
+        }
+        sf_checksound();
+        sf_sleep(10);
+    }
+
+    return 0;
+}
+
+// Draw the current input line
+void sf_DrawInput(zchar * buffer, int pos, int ptx, int pty, int width, bool cursor)
+  {
+  int height;
+  SF_textsetting * ts = sf_curtextsetting();
+
+//printf("DrawInput (%d)[%d] %d x%d y%d w%d %d\n",mywcslen(buffer),os_string_width(buffer),pos,ptx,pty,width,cursor);
+
+  height = ts->font->height(ts->font);
+
+       // Remove any previous input
+  sf_fillrect(ts->back,ptx,pty,width,height);
+
+       // Display the input
+//  sf_pushtextsettings();
+  ts->cx = ptx; ts->cy = pty;
+  os_display_string(buffer);
+
+  if (cursor)
+       {
+       int wid=0, i=0, oh;
+       while (i<pos) wid += sf_charwidth(buffer[i++], &oh);
+       drawthecursor(ptx+wid,pty,1);
+       }
+
+//  sf_poptextsettings();
+/*
+       SetTextPoint(point);
+       WriteText(buffer,mywcslen(buffer));
+
+       if (cursor)
+       {
+               int x = point.x + GetTextWidth(buffer,pos);
+               int cx = GetCharWidth('0');
+               if (*(buffer+pos) != 0)
+                       cx = GetCharWidth(*(buffer+pos));
+
+               // Invert colours
+               COLORREF fore = m_dc.GetTextColor();
+               m_dc.SetTextColor(m_dc.GetBkColor());
+               m_dc.SetBkColor(fore);
+
+               // Draw a cursor
+               m_dc.MoveTo(x,point.y);
+               CRect rect(x,point.y,x+cx,point.y+height);
+               if (*(buffer+pos) != 0)
+                       ::ExtTextOutW(m_dc.GetSafeHdc(),0,0,ETO_OPAQUE,rect,buffer+pos,1,NULL);
+               else
+                       ::ExtTextOutW(m_dc.GetSafeHdc(),0,0,ETO_OPAQUE,rect,NULL,0,NULL);
+
+               // Put colours back
+               m_dc.SetBkColor(m_dc.GetTextColor());
+               m_dc.SetTextColor(fore);
+       }*/
+
+       // Update the window
+  sf_flushdisplay();
+//     Invalidate();
+  }
+
+
+/*
+ * os_read_mouse
+ *
+ * Store the mouse position in the global variables "mouse_x" and
+ * "mouse_y", the code of the last clicked menu in "menu_selected"
+ * and return the mouse buttons currently pressed.
+ *
+ */
+zword os_read_mouse(void)
+  {
+  byte c; int x, y; zword btn = 0;
+       // Get the mouse position
+  SDL_PumpEvents();
+  c = SDL_GetMouseState(&x,&y);
+  mouse_x = x+1-blitrect.x;
+  mouse_y = y+1-blitrect.y;
+       // Get the last selected menu item
+//     menu_selected = theWnd->GetMenuClick();
+//printf("%04x\n",c);
+       // Get the mouse buttons
+  if (c & SDL_BUTTON_LMASK)
+       btn |= 1;
+  if (c & SDL_BUTTON_RMASK)
+       btn |= 2;
+  if (c & SDL_BUTTON_MMASK)
+       btn |= 4;
+
+  return btn;
+  }
+
+/*
+ * os_more_prompt
+ *
+ * Display a MORE prompt, wait for a keypress and remove the MORE
+ * prompt from the screen.
+ *
+ */
+void os_more_prompt(void)
+  {
+  if (m_morePrompts)
+       {
+       SF_textsetting * ts; int x,y,h;
+       const char *p = sf_msgstring(IDS_MORE);
+       sf_flushtext();
+//             theWnd->ResetOverhang();
+
+               // Save the current text position
+       sf_pushtextsettings();
+       ts = sf_curtextsetting();
+       x = ts->cx; y = ts->cy;
+       h = ts->font->height(ts->font);
+               // Show a [More] prompt
+       while (*p) os_display_char((zword)(*p++));
+//             theWnd->WriteText(CResString(IDS_MORE));
+//     sf_drawcursor(true);
+//     sf_flushdisplay();
+
+               // Wait for a key press
+       os_read_key(0,1);
+               // Remove the [More] prompt
+       sf_fillrect(ts->back,x,y,ts->cx-x,h);
+//     sf_drawcursor(false);
+
+               // Restore the current text position
+       sf_poptextsettings();
+       }
+}
+
+ulong * sf_savearea( int x, int y, int w, int h)
+  {
+  ulong *r, *p, *s; int i;
+
+  if (x < 0){ w += x; x = 0;}
+  if (x+w > ewidth) w = ewidth-x;
+  if (w <= 0) return NULL;
+
+  if (y < 0){ h += y; y = 0;}
+  if (y+h > eheight) h = eheight-y;
+  if (h <= 0) return NULL;
+
+  r = p = malloc((w*h+4)*sizeof(ulong));
+  if (!r) return NULL;
+
+  *p++ = x;
+  *p++ = y;
+  *p++ = w;
+  *p++ = h;
+
+  s = sbuffer+x+y*sbpitch;
+  for (i=0;i<h;i++)
+       {
+       memcpy(p,s,w*sizeof(ulong));
+       p += w;
+       s += sbpitch;
+       }
+// printf("savearea %d %d %d %d\n",x,y,w,h); fflush(stdout);
+  return r;
+  }
+
+void sf_restoreareaandfree( ulong *s)
+  {
+  ulong *p, *d; int i,x,y,w,h;
+  if (!s) return;
+
+  p = s;
+  x = *p++;
+  y = *p++;
+  w = *p++;
+  h = *p++;
+// printf("restorearea %d %d %d %d\n",x,y,w,h); fflush(stdout);
+
+  d = sbuffer+x+y*sbpitch;
+  for (i=0;i<h;i++)
+       {
+       memcpy(d,p,w*sizeof(ulong));
+       p += w;
+       d += sbpitch;
+       }
+
+  free(s);
+  dirty = 1;
+  sf_flushdisplay();
+  }
+
+int (*sf_osdialog)( bool ex, const char *def, const char *filt, const char *tit, char **res,
+       ulong *sbuf, int sbp, int ew, int eh, int isfull) = NULL;
+
+int sf_user_fdialog( bool existing, const char *defaultname, const char *filter, const char *title,
+       char **result)
+  {
+  if (sf_osdialog) return sf_osdialog(existing,defaultname,filter,title,result,
+                       sbuffer, sbpitch, ewidth, eheight, isfullscreen);
+  return SF_NOTIMP;
+  }
+
+void sf_videodata( ulong **sb, int *sp, int *ew, int *eh)
+  {
+  *sb = sbuffer;
+  *sp = sbpitch;
+  *ew = ewidth;
+  *eh = eheight;
+  }
+
+extern zword sf_yesnooverlay( int xc, int yc, char *t, int sr);
+static void sf_quitconf()
+  {
+  if (sf_yesnooverlay(ewidth/2,eheight/2,"Quit: are you sure?",1)==ZC_RETURN)
+       {
+       printf("\n\nQuitting (close button clicked on main window)\n\n");
+       SDL_Quit();
+       exit(0);
+       }
+  }
+
+void os_check_events(void)
+  {
+  SDL_Event event;
+  SDL_PumpEvents();
+  if (SDL_PeepEvents(&event,1,SDL_GETEVENT,SDL_QUITMASK))
+       sf_quitconf();
+  }
+