2013-07-06 04:37:13 +00:00
|
|
|
/*
|
|
|
|
* Apple // emulator for Linux: Configuration Interface
|
2013-06-11 07:08:15 +00:00
|
|
|
*
|
|
|
|
* Copyright 1994 Alexander Jean-Claude Bottema
|
|
|
|
* Copyright 1995 Stephen Lee
|
|
|
|
* Copyright 1997, 1998 Aaron Culliney
|
|
|
|
* Copyright 1998, 1999, 2000 Michael Deutschmann
|
|
|
|
*
|
|
|
|
* This software package is subject to the GNU General Public License
|
2013-07-06 04:37:13 +00:00
|
|
|
* version 2 or later (your choice) as published by the Free Software
|
2013-06-11 07:08:15 +00:00
|
|
|
* Foundation.
|
|
|
|
*
|
2013-07-06 04:37:13 +00:00
|
|
|
* THERE ARE NO WARRANTIES WHATSOEVER.
|
2013-06-11 07:08:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
#include "common.h"
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2014-09-17 03:42:07 +00:00
|
|
|
bool in_interface = false;
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
static struct stat statbuf;
|
|
|
|
static int altdrive;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/*#define undoc_supported 1*/
|
|
|
|
/*#else*/
|
|
|
|
/*#define undoc_supported 0*/
|
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
void copy_and_pad_string(char *dest, const char* src, const char c, const int len, const char cap)
|
|
|
|
{
|
2013-12-01 20:08:17 +00:00
|
|
|
const char* p;
|
|
|
|
char* d = dest;
|
|
|
|
|
|
|
|
for (p = src; ((*p != '\0') && (p-src < len-1)); p++)
|
|
|
|
{
|
|
|
|
*d++ = *p;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (d-dest < len-1)
|
|
|
|
{
|
|
|
|
*d++ = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
*d = cap;
|
|
|
|
}
|
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
static void pad_string(char *s, const char c, const int len) {
|
2013-06-11 07:08:15 +00:00
|
|
|
char *p;
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
for (p = s; ((*p != '\0') && (p-s < len-1)); p++)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
while (p-s < len-1)
|
|
|
|
{
|
|
|
|
*p++ = c;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_load_interface_font()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void c_load_interface_font()
|
|
|
|
{
|
|
|
|
video_loadfont_int(0x00,0x40,ucase_glyphs);
|
|
|
|
video_loadfont_int(0x40,0x20,ucase_glyphs);
|
|
|
|
video_loadfont_int(0x60,0x20,lcase_glyphs);
|
|
|
|
video_loadfont_int(0x80,0x40,ucase_glyphs);
|
|
|
|
video_loadfont_int(0xC0,0x20,ucase_glyphs);
|
|
|
|
video_loadfont_int(0xE0,0x20,lcase_glyphs);
|
|
|
|
|
|
|
|
video_loadfont_int(0x80,11,interface_glyphs);
|
2013-11-30 22:14:22 +00:00
|
|
|
video_loadfont_int(MOUSETEXT_BEGIN,0x20,mousetext_glyphs);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_print()
|
|
|
|
------------------------------------------------------------------------- */
|
2013-10-06 08:31:58 +00:00
|
|
|
void c_interface_print( int x, int y, int cs, const char *s )
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
for (; *s; x++, s++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
video_plotchar( x, y, cs, *s );
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_print_screen()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
void c_interface_print_screen( char screen[24][INTERFACE_SCREEN_X+1] )
|
|
|
|
{
|
|
|
|
for (int y = 0; y < 24; y++)
|
|
|
|
{
|
|
|
|
c_interface_print( 0, y, 2, screen[ y ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_translate_screen()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-11-24 22:08:45 +00:00
|
|
|
#define IsGraphic(c) ((c) == '|' || (((unsigned char)c) >= 0x80 && ((unsigned char)c) <= 0x8A))
|
2013-11-27 20:43:58 +00:00
|
|
|
#define IsInside(x,y) ((x) >= 0 && (x) <= xlen-1 && (y) >= 0 && (y) <= ylen-1)
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
static void _convert_screen_graphics( char *screen, const int x, const int y, const int xlen, const int ylen )
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
static char map[11][3][4] ={ { "...",
|
|
|
|
".||",
|
|
|
|
".|." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ "...",
|
|
|
|
"||.",
|
|
|
|
".|." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ ".|.",
|
|
|
|
".||",
|
|
|
|
"..." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ ".|.",
|
|
|
|
"||.",
|
|
|
|
"..." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-11-24 22:08:45 +00:00
|
|
|
{ "~|~",
|
2013-07-06 04:37:13 +00:00
|
|
|
".|.",
|
2013-11-24 22:08:45 +00:00
|
|
|
"~|~" },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-11-24 22:08:45 +00:00
|
|
|
{ "~.~",
|
2013-07-06 04:37:13 +00:00
|
|
|
"|||",
|
2013-11-24 22:08:45 +00:00
|
|
|
"~.~" },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ ".|.",
|
|
|
|
".||",
|
|
|
|
".|." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ ".|.",
|
|
|
|
"||.",
|
|
|
|
".|." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ "...",
|
|
|
|
"|||",
|
|
|
|
".|." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ ".|.",
|
|
|
|
"|||",
|
|
|
|
"..." },
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
{ ".|.",
|
|
|
|
"|||",
|
|
|
|
".|." } };
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-11-24 22:08:45 +00:00
|
|
|
bool found_glyph = false;
|
|
|
|
int k = 10;
|
|
|
|
for (; k >= 0; k--)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-24 22:08:45 +00:00
|
|
|
found_glyph = true;
|
|
|
|
|
|
|
|
for (int yy = y - 1; found_glyph && yy <= y + 1; yy++)
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
int idx = yy*(xlen+1);
|
2013-11-24 22:08:45 +00:00
|
|
|
for (int xx = x - 1; xx <= x + 1; xx++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-24 22:08:45 +00:00
|
|
|
char map_ch = map[k][ yy - y + 1 ][ xx - x + 1 ];
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-11-24 22:08:45 +00:00
|
|
|
if (IsInside(xx, yy))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
char c = *(screen + idx + xx);
|
|
|
|
if (!IsGraphic( c ) && (map_ch == '|'))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-24 22:08:45 +00:00
|
|
|
found_glyph = false;
|
|
|
|
break;
|
|
|
|
}
|
2013-11-27 20:43:58 +00:00
|
|
|
else if (IsGraphic( c ) && (map_ch == '.'))
|
2013-11-24 22:08:45 +00:00
|
|
|
{
|
|
|
|
found_glyph = false;
|
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
2013-11-24 22:08:45 +00:00
|
|
|
else if (map_ch == '|')
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-24 22:08:45 +00:00
|
|
|
found_glyph = false;
|
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
2013-11-27 20:43:58 +00:00
|
|
|
idx += xlen+1;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-11-24 22:08:45 +00:00
|
|
|
|
|
|
|
if (found_glyph)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found_glyph)
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
*(screen + y*(xlen+1) + x) = 0x80 + k;
|
2013-11-24 22:08:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
static void c_interface_translate_screen_x_y(char *screen, const int xlen, const int ylen)
|
2013-11-24 22:08:45 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
for (int idx=0, y=0; y < ylen; y++, idx+=xlen+1)
|
2013-11-24 22:08:45 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
for (int x = 0; x < xlen; x++)
|
2013-11-24 22:08:45 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
if (*(screen + idx + x) == '|')
|
2013-11-24 22:08:45 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
_convert_screen_graphics(screen, x, y, xlen, ylen);
|
2013-11-27 20:43:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
void c_interface_translate_screen( char screen[24][INTERFACE_SCREEN_X+1] )
|
2013-11-27 20:43:58 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
|
|
|
|
c_interface_translate_screen_x_y(screen[0], INTERFACE_SCREEN_X, 24);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_print_submenu_centered()
|
|
|
|
------------------------------------------------------------------------- */
|
2013-12-22 07:55:23 +00:00
|
|
|
void c_interface_print_submenu_centered( char *submenu, const int xlen, const int ylen )
|
2013-11-27 20:43:58 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
c_interface_translate_screen_x_y(submenu, xlen, ylen);
|
2013-11-27 20:43:58 +00:00
|
|
|
int x = (INTERFACE_SCREEN_X - xlen) >> 1;
|
|
|
|
int y = (24 - ylen) >> 1;
|
|
|
|
|
|
|
|
int ymax = y+ylen;
|
|
|
|
for (int idx=0; y < ymax; y++, idx+=xlen+1)
|
|
|
|
{
|
|
|
|
c_interface_print( x, y, 2, &submenu[ idx ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
static int c_interface_cut_name(char *name)
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
|
|
|
char *p = name + strlen(name) - 1;
|
|
|
|
int is_gz = 0;
|
|
|
|
|
|
|
|
if (p >= name && *p == 'z')
|
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
p--;
|
|
|
|
if (p >= name && *p == 'g')
|
|
|
|
{
|
|
|
|
p--;
|
|
|
|
if (p >= name && *p == '.')
|
|
|
|
{
|
|
|
|
*p-- = '\0';
|
|
|
|
is_gz = 1;
|
|
|
|
}
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return is_gz;
|
|
|
|
}
|
|
|
|
|
2014-03-26 05:11:01 +00:00
|
|
|
static int disk_select(const struct dirent *e)
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
static char cmp[ DISKSIZE ];
|
2013-06-11 07:08:15 +00:00
|
|
|
size_t len;
|
|
|
|
const char *p;
|
|
|
|
|
|
|
|
strncpy( cmp, disk_path, DISKSIZE );
|
2013-06-19 07:07:41 +00:00
|
|
|
strncat( cmp, "/", DISKSIZE-1 );
|
2013-07-06 04:37:13 +00:00
|
|
|
strncat( cmp, e->d_name, DISKSIZE-1 );
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* don't show disk in alternate drive */
|
|
|
|
if (!strcmp(cmp, disk6.disk[altdrive].file_name))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* show directories except '.' and '..' at toplevel. */
|
|
|
|
stat(cmp, &statbuf);
|
|
|
|
if (S_ISDIR(statbuf.st_mode) && strcmp(".", e->d_name) &&
|
2013-07-06 04:37:13 +00:00
|
|
|
!(!strcmp("..", e->d_name) && !strcmp(disk_path, "/")))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
p = e->d_name;
|
|
|
|
len = strlen(p);
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2014-03-26 05:11:01 +00:00
|
|
|
if (len > 3 && (!strcmp(p + len - 3, ".gz")))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-03-26 05:11:01 +00:00
|
|
|
len -= 3;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 05:11:01 +00:00
|
|
|
if (!strncmp(p + len - 4, ".dsk", 4))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-03-26 05:11:01 +00:00
|
|
|
return 1;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 05:11:01 +00:00
|
|
|
if (!strncmp(p + len - 4, ".nib", 4))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-03-26 05:11:01 +00:00
|
|
|
return 1;
|
2013-12-01 19:14:19 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 05:11:01 +00:00
|
|
|
if (!strncmp(p + len - 3, ".do", 3))
|
2013-12-01 19:14:19 +00:00
|
|
|
{
|
2014-03-26 05:11:01 +00:00
|
|
|
return 1;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_exit()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
void c_interface_exit(int ch)
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-12-15 22:59:18 +00:00
|
|
|
if (c_keys_is_interface_key(ch))
|
|
|
|
{
|
|
|
|
c_keys_set_key(ch);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
video_setpage(!!(softswitches & SS_SCREEN));
|
|
|
|
video_redraw();
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_select_diskette()
|
|
|
|
------------------------------------------------------------------------- */
|
2014-09-17 03:40:42 +00:00
|
|
|
#define ZLIB_SUBMENU_H 7
|
|
|
|
#define ZLIB_SUBMENU_W 40
|
|
|
|
static char zlibmenu[ZLIB_SUBMENU_H][ZLIB_SUBMENU_W+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40.
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| An error occurred when attempting to |",
|
|
|
|
"| handle a compressed disk image: |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||" };
|
|
|
|
|
|
|
|
static void _eject_disk(int drive) {
|
|
|
|
const char *err_str = c_eject_6(drive);
|
|
|
|
if (err_str) {
|
|
|
|
int ch = -1;
|
|
|
|
snprintf(&zlibmenu[4][2], 37, "%s", err_str);
|
|
|
|
c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H);
|
|
|
|
while ((ch = c_mygetch(1)) == -1) {
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
void c_interface_select_diskette( int drive )
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
#define DISK_PATH_MAX 77
|
|
|
|
#define DRIVE_X 49
|
|
|
|
char screen[24][INTERFACE_SCREEN_X+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80.",
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| Insert diskette into Drive _, Slot 6 |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| For interface help press '?' |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" };
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
struct dirent **namelist;
|
|
|
|
bool nextdir = false;
|
2013-07-06 04:37:13 +00:00
|
|
|
int i, entries;
|
|
|
|
static int curpos=0;
|
2013-12-15 22:59:18 +00:00
|
|
|
int ch = -1;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
screen[ 1 ][ DRIVE_X ] = (drive == 0) ? 'A' : 'B';
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
video_setpage( 0 );
|
|
|
|
|
|
|
|
c_interface_translate_screen( screen );
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
do {
|
|
|
|
nextdir = false;
|
|
|
|
c_interface_print_screen( screen );
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
altdrive = (drive == 0) ? 1 : 0;
|
|
|
|
if (!strcmp("", disk_path))
|
|
|
|
{
|
|
|
|
sprintf(disk_path, "/");
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-12-01 20:08:17 +00:00
|
|
|
#define DISKERR_PAD 35
|
|
|
|
#define DISKERR_SUBMENU_H 6
|
|
|
|
#define DISKERR_SUBMENU_W 40
|
|
|
|
char errmenu[DISKERR_SUBMENU_H][DISKERR_SUBMENU_W+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40.
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| An error occurred: |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||" };
|
|
|
|
#define DISKERR_SHOWERR(ERR) \
|
2013-12-06 20:15:03 +00:00
|
|
|
copy_and_pad_string(&errmenu[3][2], ERR, ' ', DISKERR_PAD, ' '); \
|
2013-12-01 20:08:17 +00:00
|
|
|
c_interface_print_submenu_centered(errmenu[0], DISKERR_SUBMENU_W, DISKERR_SUBMENU_H); \
|
|
|
|
while ((ch = c_mygetch(1)) == -1) { }
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
/* set to users privilege level for directory access */
|
2014-03-26 05:11:01 +00:00
|
|
|
entries = scandir(disk_path, &namelist, disk_select, alphasort);
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
if (entries <= 0)
|
|
|
|
{
|
2013-12-01 20:08:17 +00:00
|
|
|
DISKERR_SHOWERR("Problem reading directory");
|
|
|
|
snprintf(disk_path, DISKSIZE, "%s", getenv("HOME"));
|
|
|
|
nextdir = true;
|
|
|
|
continue;
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
if (curpos >= entries)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
curpos = entries - 1;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2014-05-12 02:18:53 +00:00
|
|
|
char temp[PATH_MAX];
|
2013-12-01 04:00:34 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
for (i = 0; i < 18; i++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
int ent_no = curpos - 8 + i, slen;
|
|
|
|
int in_drive = 0;
|
|
|
|
|
|
|
|
strcpy( temp, " " );
|
|
|
|
if (ent_no >= 0 && ent_no < entries)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-05-12 02:18:53 +00:00
|
|
|
snprintf(temp, PATH_MAX, "%s/%s",
|
2013-12-01 04:00:34 +00:00
|
|
|
disk_path, namelist[ent_no]->d_name);
|
|
|
|
if (!strcmp(temp, disk6.disk[drive].file_name))
|
|
|
|
{
|
|
|
|
in_drive = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
stat(temp, &statbuf);
|
|
|
|
if (S_ISDIR(statbuf.st_mode))
|
|
|
|
{
|
2014-05-12 02:18:53 +00:00
|
|
|
snprintf(temp, PATH_MAX, " %s/",
|
2013-12-01 04:00:34 +00:00
|
|
|
namelist[ ent_no ]->d_name );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-12 02:18:53 +00:00
|
|
|
snprintf(temp, PATH_MAX, " %s",
|
2013-12-01 04:00:34 +00:00
|
|
|
namelist[ ent_no ]->d_name );
|
|
|
|
}
|
|
|
|
|
|
|
|
if (c_interface_cut_name(temp))
|
|
|
|
{
|
2014-05-12 02:18:53 +00:00
|
|
|
strncat(temp, " <gz>", PATH_MAX-1);
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
|
|
|
/* write protected disk in drive? */
|
2013-12-01 18:42:05 +00:00
|
|
|
else if ((in_drive) && (disk6.disk[drive].is_protected))
|
2013-12-01 04:00:34 +00:00
|
|
|
{
|
2014-05-12 02:18:53 +00:00
|
|
|
strncat(temp, (drive == 0) ? " <r1>" : " <r2>", PATH_MAX-1);
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
|
|
|
else if (in_drive)
|
|
|
|
{
|
2014-05-12 02:18:53 +00:00
|
|
|
strncat(temp, (drive == 0) ? " <rw1>" : " <rw2>", PATH_MAX-1);
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
slen = strlen( temp );
|
|
|
|
while (slen < DISK_PATH_MAX)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
temp[ slen++ ] = ' ';
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
|
|
|
|
temp[ DISK_PATH_MAX ] = '\0';
|
|
|
|
|
|
|
|
c_interface_print(1, i + 3, ent_no == curpos, temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ch = c_mygetch(1);
|
|
|
|
}
|
|
|
|
while (ch == -1);
|
|
|
|
|
2013-12-01 18:57:24 +00:00
|
|
|
if (ch == kUP)
|
2013-12-01 04:00:34 +00:00
|
|
|
{
|
|
|
|
if (curpos > 0)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
curpos--;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
2013-12-30 02:07:24 +00:00
|
|
|
else if (ch == kDN)
|
2013-12-01 04:00:34 +00:00
|
|
|
{
|
|
|
|
if (curpos < entries - 1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
curpos++;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
2013-12-01 18:57:24 +00:00
|
|
|
else if (ch == kPGDN)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
curpos += 16;
|
|
|
|
if (curpos > entries - 1)
|
|
|
|
{
|
|
|
|
curpos = entries - 1;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 18:57:24 +00:00
|
|
|
else if (ch == kPGUP)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
curpos -= 16;
|
|
|
|
if (curpos < 0)
|
|
|
|
{
|
|
|
|
curpos = 0;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 18:57:24 +00:00
|
|
|
else if (ch == kHOME)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
curpos = 0;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 18:57:24 +00:00
|
|
|
else if (ch == kEND)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
curpos = entries - 1;
|
|
|
|
}
|
2013-12-15 22:59:18 +00:00
|
|
|
else if ((ch == kESC) || c_keys_is_interface_key(ch))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
else if (ch == '?')
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
#define DISKHELP_SUBMENU_H 17
|
|
|
|
#define DISKHELP_SUBMENU_W 40
|
2013-12-01 04:00:34 +00:00
|
|
|
char submenu[DISKHELP_SUBMENU_H][DISKHELP_SUBMENU_W+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40.
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
2013-12-01 20:08:17 +00:00
|
|
|
"| Disk : @ and @ arrows |",
|
2013-12-01 04:00:34 +00:00
|
|
|
"| Selection : PageUp/PageDown |",
|
|
|
|
"| Home/End |",
|
|
|
|
"| |",
|
|
|
|
"| Insert : (RO) Press 'Return' to |",
|
|
|
|
"| Disk : insert disk read-only |",
|
|
|
|
"| (RW) Press 'W' key to |",
|
|
|
|
"| insert disk read/write |",
|
|
|
|
"| |",
|
|
|
|
"| Eject : Choose selected disk and |",
|
|
|
|
"| Disk : press 'Return' |",
|
|
|
|
"| |",
|
2013-12-01 20:08:17 +00:00
|
|
|
"| Exit Menu : ESC returns to emulator |",
|
2013-12-01 04:00:34 +00:00
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||" };
|
2013-11-27 20:43:58 +00:00
|
|
|
|
2013-12-01 20:08:17 +00:00
|
|
|
submenu[ 2 ][ 14 ] = MOUSETEXT_BEGIN + 0x0b;
|
|
|
|
submenu[ 2 ][ 20 ] = MOUSETEXT_BEGIN + 0x0a;
|
|
|
|
c_interface_print_submenu_centered(submenu[0], DISKHELP_SUBMENU_W, DISKHELP_SUBMENU_H);
|
2013-12-01 04:00:34 +00:00
|
|
|
while ((ch = c_mygetch(1)) == -1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
c_interface_print_screen( screen );
|
|
|
|
}
|
2013-12-01 18:57:24 +00:00
|
|
|
else if ((ch == 13) || (toupper(ch) == 'W'))
|
2013-12-01 04:00:34 +00:00
|
|
|
{
|
2013-12-01 18:57:24 +00:00
|
|
|
int len;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2014-05-12 02:18:53 +00:00
|
|
|
snprintf(temp, PATH_MAX, "%s/%s",
|
2013-12-01 04:00:34 +00:00
|
|
|
disk_path, namelist[ curpos ]->d_name );
|
|
|
|
len = strlen(disk_path);
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
/* handle disk currently in the drive */
|
|
|
|
if (!strcmp(temp, disk6.disk[drive].file_name))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
/* reopen disk, forcing write enabled */
|
|
|
|
if (toupper(ch) == 'W')
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-09-17 03:40:42 +00:00
|
|
|
const char *err_str = c_new_diskette_6(drive, temp, 0);
|
|
|
|
if (err_str)
|
2013-11-27 20:43:58 +00:00
|
|
|
{
|
2014-09-17 03:40:42 +00:00
|
|
|
int ch = -1;
|
|
|
|
snprintf(&zlibmenu[4][2], 37, "%s", err_str);
|
|
|
|
c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H);
|
|
|
|
while ((ch = c_mygetch(1)) == -1) {
|
|
|
|
// ...
|
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
c_interface_print_screen( screen );
|
|
|
|
continue;
|
2013-11-27 20:43:58 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
/* eject the disk and start over */
|
2014-09-17 03:40:42 +00:00
|
|
|
_eject_disk(drive);
|
2013-12-01 18:57:24 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
nextdir = true;
|
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
/* read another directory */
|
|
|
|
stat(temp, &statbuf);
|
|
|
|
if (S_ISDIR(statbuf.st_mode))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
if (toupper(ch) == 'W')
|
|
|
|
{
|
2013-12-01 18:57:24 +00:00
|
|
|
continue;
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
if ((disk_path[len-1]) == '/')
|
|
|
|
{
|
|
|
|
disk_path[--len] = '\0';
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
if (!strcmp("..", namelist[curpos]->d_name))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-01 04:00:34 +00:00
|
|
|
while (--len && (disk_path[len] != '/'))
|
|
|
|
{
|
|
|
|
disk_path[len] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(".", namelist[curpos]->d_name))
|
|
|
|
{
|
|
|
|
snprintf(disk_path + len, DISKSIZE-len, "/%s",
|
|
|
|
namelist[curpos]->d_name);
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
nextdir = true;
|
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2014-09-17 03:40:42 +00:00
|
|
|
_eject_disk(drive);
|
2013-12-01 18:57:24 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-12-01 04:00:34 +00:00
|
|
|
|
2014-09-17 03:40:42 +00:00
|
|
|
const char *err_str = c_new_diskette_6(drive, temp, (toupper(ch) != 'W'));
|
|
|
|
if (err_str)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-09-17 03:40:42 +00:00
|
|
|
int ch = -1;
|
|
|
|
snprintf(&zlibmenu[4][2], 37, "%s", err_str);
|
|
|
|
c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H);
|
|
|
|
while ((ch = c_mygetch(1)) == -1) {
|
|
|
|
// ...
|
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
// clean up
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-01 04:00:34 +00:00
|
|
|
for (i = 0; i < entries; i++)
|
|
|
|
{
|
|
|
|
free(namelist[ i ]);
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-01 04:00:34 +00:00
|
|
|
free(namelist);
|
|
|
|
|
|
|
|
} while (nextdir);
|
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
c_interface_exit(ch);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_parameters()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
typedef enum interface_enum_t {
|
|
|
|
OPT_CPU = 0,
|
|
|
|
OPT_ALTCPU,
|
2014-03-26 06:42:05 +00:00
|
|
|
OPT_QUIT,
|
|
|
|
OPT_REBOOT,
|
|
|
|
OPT_JOYSTICK,
|
|
|
|
OPT_CALIBRATE,
|
2013-10-06 08:31:58 +00:00
|
|
|
OPT_PATH,
|
|
|
|
OPT_COLOR,
|
2014-10-08 05:05:14 +00:00
|
|
|
#if !VIDEO_OPENGL
|
2014-01-04 22:24:55 +00:00
|
|
|
OPT_VIDEO,
|
2014-10-08 05:05:14 +00:00
|
|
|
#endif
|
2013-12-07 06:55:00 +00:00
|
|
|
OPT_VOLUME,
|
2014-03-26 06:42:05 +00:00
|
|
|
OPT_CAPS,
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
NUM_OPTIONS
|
|
|
|
} interface_enum_t;
|
|
|
|
|
|
|
|
static const char *options[] =
|
|
|
|
{
|
2014-03-26 06:42:05 +00:00
|
|
|
" CPU% : ",
|
2013-12-22 07:55:23 +00:00
|
|
|
" ALT CPU% : ",
|
2014-03-26 06:42:05 +00:00
|
|
|
" --> Quit Emulator",
|
|
|
|
" --> Reboot Emulator",
|
2013-12-22 07:55:23 +00:00
|
|
|
" Joystick : ",
|
2014-03-26 06:42:05 +00:00
|
|
|
" --> Calibrate Joystick",
|
|
|
|
" Path : ",
|
|
|
|
" Color : ",
|
2014-10-30 04:48:44 +00:00
|
|
|
#if !VIDEO_OPENGL
|
2014-03-26 06:42:05 +00:00
|
|
|
" Video : ",
|
2014-10-30 04:48:44 +00:00
|
|
|
#endif
|
2014-03-26 06:42:05 +00:00
|
|
|
" Volume : ",
|
|
|
|
" CAPSlock : ",
|
2013-10-06 08:31:58 +00:00
|
|
|
};
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
#define INTERFACE_PATH_MAX 65
|
|
|
|
#define INTERFACE_PATH_MIN 14
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
void c_interface_parameters()
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
char screen[24][INTERFACE_SCREEN_X+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80.",
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| @ Apple //ix @ |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| Emulator Hotkeys |",
|
|
|
|
"| |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| F1 F2: Insert Diskette in Slot6 Disk Drive A or Drive B |",
|
|
|
|
"| F5 : Show Keyboard Layout F7 : 6502 Debugger |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"| F9 : Toggle Between CPU% / ALT CPU% Speeds |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| F10 : Show This Menu |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"| |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| For interface help press '?' ... ESC exits menu |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" };
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
#define PARAMS_H 9 /* visual height */
|
2013-07-06 04:37:13 +00:00
|
|
|
int i;
|
|
|
|
int ch;
|
2013-10-06 08:31:58 +00:00
|
|
|
static interface_enum_t option = OPT_CPU;
|
2013-07-06 04:37:13 +00:00
|
|
|
static int cur_y = 0, cur_off = 0, cur_x = 0, cur_pos = 0;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* reset the x position, so we don't lose our cursor if path changes */
|
|
|
|
cur_x = 0;
|
|
|
|
video_setpage( 0 );
|
|
|
|
|
2013-12-01 20:08:17 +00:00
|
|
|
screen[ 2 ][ 33 ] = MOUSETEXT_BEGIN + 0x01;
|
|
|
|
screen[ 2 ][ 46 ] = MOUSETEXT_BEGIN + 0x00;
|
2013-11-30 22:14:22 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
c_interface_translate_screen( screen );
|
2013-11-27 20:43:58 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2014-05-12 02:18:53 +00:00
|
|
|
#define TEMPSIZE 1024
|
|
|
|
char temp[TEMPSIZE];
|
2013-10-06 08:31:58 +00:00
|
|
|
for (;;)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-28 22:28:04 +00:00
|
|
|
for (i = 0; (i < PARAMS_H) && (i < NUM_OPTIONS); i++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-03-26 06:42:05 +00:00
|
|
|
cur_off = (option - PARAMS_H) +1;
|
2013-07-06 04:37:13 +00:00
|
|
|
if (cur_off < 0)
|
|
|
|
{
|
|
|
|
cur_off = 0;
|
|
|
|
}
|
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
c_interface_print( 1, 5 + i, cur_y == i, options[i + cur_off]);
|
|
|
|
|
|
|
|
int optlen = strlen(options[i + cur_off]);
|
|
|
|
snprintf(temp, TEMPSIZE, " ");
|
|
|
|
pad_string(temp, ' ', INTERFACE_PATH_MAX+1-optlen);
|
|
|
|
c_interface_print( 1+optlen, 5 + i, 0, temp );
|
2013-07-06 04:37:13 +00:00
|
|
|
|
|
|
|
switch (i + cur_off)
|
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_CPU:
|
|
|
|
if (cpu_scale_factor >= CPU_SCALE_FASTEST)
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "Fastest");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%d%%", (int)(cpu_scale_factor * 100.0));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_ALTCPU:
|
|
|
|
if (cpu_altscale_factor >= CPU_SCALE_FASTEST)
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "Fastest");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%d%%", (int)(cpu_altscale_factor * 100.0));
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_PATH:
|
2013-11-27 20:43:58 +00:00
|
|
|
strncpy(temp, disk_path + cur_pos, INTERFACE_PATH_MAX);
|
|
|
|
temp[INTERFACE_PATH_MAX] = '\0';
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_COLOR:
|
2013-12-07 06:55:00 +00:00
|
|
|
sprintf(temp, "%s", (color_mode == COLOR) ? "Color " :
|
|
|
|
(color_mode == COLOR_INTERP) ? "Interpolated" : "Black/White ");
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-10-08 05:05:14 +00:00
|
|
|
#if !VIDEO_OPENGL
|
2014-01-04 22:24:55 +00:00
|
|
|
case OPT_VIDEO:
|
|
|
|
sprintf(temp, "%s", (a2_video_mode == VIDEO_1X) ? "1X " : (a2_video_mode == VIDEO_2X) ? "2X " : "Fullscreen");
|
|
|
|
break;
|
2014-10-08 05:05:14 +00:00
|
|
|
#endif
|
2014-01-04 22:24:55 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_JOYSTICK:
|
2014-11-09 21:13:27 +00:00
|
|
|
snprintf(temp, TEMPSIZE, "%s", (joy_mode == JOY_KPAD) ? "Emulated on Keypad" : "PC Joystick ");
|
2014-03-26 06:42:05 +00:00
|
|
|
break;
|
|
|
|
|
2013-12-07 06:55:00 +00:00
|
|
|
case OPT_VOLUME:
|
|
|
|
if (sound_volume == 0)
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%s", "Off ");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%d", sound_volume);
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_CAPS:
|
|
|
|
if (caps_lock)
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%s", "On ");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%s", "Off ");
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_CALIBRATE:
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_QUIT:
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_REBOOT:
|
|
|
|
break;
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
pad_string(temp, ' ', INTERFACE_PATH_MAX+1);
|
2013-12-22 07:55:23 +00:00
|
|
|
int loc = i+cur_off;
|
2014-03-26 06:42:05 +00:00
|
|
|
if ((loc != OPT_PATH) && (loc != OPT_QUIT) && (loc != OPT_REBOOT) && (loc != OPT_CALIBRATE))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
c_interface_print(INTERFACE_PATH_MIN, 5 + i, 0, temp);
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-12-22 07:55:23 +00:00
|
|
|
else if (loc == OPT_PATH)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
for (j = 0; j < INTERFACE_PATH_MAX; j++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
if (cur_x != j)
|
|
|
|
{
|
|
|
|
if (temp[ j ] == '\0')
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
video_plotchar( INTERFACE_PATH_MIN + j, 5+i, 0, ' ' );
|
2013-07-06 04:37:13 +00:00
|
|
|
j++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
video_plotchar( INTERFACE_PATH_MIN + j, 5+i, 0, temp[ j ] );
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (temp[ j ] == '\0')
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
video_plotchar( INTERFACE_PATH_MIN + j, 5+i, option==OPT_PATH,' ' );
|
2013-07-06 04:37:13 +00:00
|
|
|
j++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
video_plotchar( INTERFACE_PATH_MIN + j, 5+i, option==OPT_PATH, temp[ j ]);
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
for (; j < INTERFACE_PATH_MAX; j++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
video_plotchar( INTERFACE_PATH_MIN + j, 5+i, 0, ' ' );
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ch = c_mygetch(1);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
while (ch == -1);
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (ch == kUP) /* Arrow up */
|
|
|
|
{
|
2013-12-28 22:28:04 +00:00
|
|
|
if (option > PARAMS_H-1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
option--; /* only dec option */
|
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
else if (option > 0)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
option--; /* dec option */
|
|
|
|
cur_y--; /* and dec y position */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
option = NUM_OPTIONS-1; /* wrap to last option */
|
2013-12-28 22:28:04 +00:00
|
|
|
cur_y = PARAMS_H-1; /* wrap to last y position */
|
|
|
|
if (cur_y >= NUM_OPTIONS)
|
|
|
|
{
|
|
|
|
cur_y = NUM_OPTIONS-1;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
2013-12-30 02:07:24 +00:00
|
|
|
else if (ch == kDN) /* Arrow down */
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-28 22:28:04 +00:00
|
|
|
++option;
|
|
|
|
|
|
|
|
if (cur_y < PARAMS_H-1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_y++; /* and inc y position */
|
|
|
|
}
|
2013-12-28 22:28:04 +00:00
|
|
|
|
|
|
|
if (option >= NUM_OPTIONS)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_y = option = 0; /* wrap both to first */
|
|
|
|
}
|
|
|
|
}
|
2013-12-30 02:07:24 +00:00
|
|
|
else if ((ch == kLT) && (c_rawkey() != SCODE_BS)) /* Arrow left */
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
switch (option)
|
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_CPU:
|
|
|
|
cpu_scale_factor -= (cpu_scale_factor <= 1.0) ? CPU_SCALE_STEP_DIV : CPU_SCALE_STEP;
|
|
|
|
if (cpu_scale_factor < CPU_SCALE_SLOWEST)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
cpu_scale_factor = CPU_SCALE_SLOWEST;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_ALTCPU:
|
|
|
|
cpu_altscale_factor -= (cpu_altscale_factor <= 1.0) ? CPU_SCALE_STEP_DIV : CPU_SCALE_STEP;
|
|
|
|
if (cpu_altscale_factor < CPU_SCALE_SLOWEST)
|
|
|
|
{
|
|
|
|
cpu_altscale_factor = CPU_SCALE_SLOWEST;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_PATH:
|
2013-07-06 04:37:13 +00:00
|
|
|
if (cur_x > 0)
|
|
|
|
{
|
|
|
|
cur_x--;
|
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
else if (cur_pos > 0)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_pos--;
|
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_COLOR:
|
2013-07-06 04:37:13 +00:00
|
|
|
if (color_mode == 0)
|
|
|
|
{
|
2013-12-07 06:55:00 +00:00
|
|
|
color_mode = NUM_COLOROPTS-1;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
--color_mode;
|
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-10-08 05:05:14 +00:00
|
|
|
#if !VIDEO_OPENGL
|
2014-01-04 22:24:55 +00:00
|
|
|
case OPT_VIDEO:
|
|
|
|
if (a2_video_mode == 1)
|
|
|
|
{
|
|
|
|
a2_video_mode = NUM_VIDOPTS-1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
--a2_video_mode;
|
|
|
|
}
|
|
|
|
video_set_mode(a2_video_mode);
|
|
|
|
break;
|
2014-10-08 05:05:14 +00:00
|
|
|
#endif
|
2014-01-04 22:24:55 +00:00
|
|
|
|
2013-12-07 06:55:00 +00:00
|
|
|
case OPT_VOLUME:
|
|
|
|
if (sound_volume > 0)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-07 06:55:00 +00:00
|
|
|
--sound_volume;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_CAPS:
|
|
|
|
if (caps_lock) {
|
|
|
|
caps_lock = false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_JOYSTICK:
|
2013-07-06 04:37:13 +00:00
|
|
|
if (joy_mode == 0)
|
|
|
|
{
|
2013-12-07 06:55:00 +00:00
|
|
|
joy_mode = NUM_JOYOPTS-1;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
--joy_mode;
|
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_CALIBRATE:
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_QUIT:
|
|
|
|
break;
|
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_REBOOT:
|
|
|
|
break;
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
default:
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-12-30 02:07:24 +00:00
|
|
|
else if (ch == kRT) /* Arrow right */
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
switch (option)
|
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_CPU:
|
|
|
|
cpu_scale_factor += (cpu_scale_factor < 1.0) ? CPU_SCALE_STEP_DIV : CPU_SCALE_STEP;
|
|
|
|
if (cpu_scale_factor >= CPU_SCALE_FASTEST)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
cpu_scale_factor = CPU_SCALE_FASTEST;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
break;
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_ALTCPU:
|
|
|
|
cpu_altscale_factor += (cpu_altscale_factor < 1.0) ? CPU_SCALE_STEP_DIV : CPU_SCALE_STEP;
|
|
|
|
if (cpu_altscale_factor >= CPU_SCALE_FASTEST)
|
|
|
|
{
|
|
|
|
cpu_altscale_factor = CPU_SCALE_FASTEST;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_PATH:
|
2013-11-27 20:43:58 +00:00
|
|
|
if (cur_x < INTERFACE_PATH_MAX-1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
if (disk_path[cur_pos + cur_x] != '\0')
|
|
|
|
{
|
|
|
|
cur_x++;
|
|
|
|
}
|
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
else if (disk_path[cur_pos + cur_x] != '\0')
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_pos++;
|
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_COLOR:
|
2013-12-07 06:55:00 +00:00
|
|
|
if (color_mode == NUM_COLOROPTS-1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
color_mode = 0;
|
|
|
|
}
|
2013-12-07 06:55:00 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
++color_mode;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-10-08 05:05:14 +00:00
|
|
|
#if !VIDEO_OPENGL
|
2014-01-04 22:24:55 +00:00
|
|
|
case OPT_VIDEO:
|
|
|
|
if (a2_video_mode == NUM_VIDOPTS-1)
|
|
|
|
{
|
|
|
|
a2_video_mode = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++a2_video_mode;
|
|
|
|
}
|
|
|
|
video_set_mode(a2_video_mode);
|
|
|
|
break;
|
2014-10-08 05:05:14 +00:00
|
|
|
#endif
|
2014-01-04 22:24:55 +00:00
|
|
|
|
2013-12-07 06:55:00 +00:00
|
|
|
case OPT_VOLUME:
|
|
|
|
sound_volume++;
|
|
|
|
if (sound_volume > 10)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-07 06:55:00 +00:00
|
|
|
sound_volume = 10;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_CAPS:
|
|
|
|
if (!caps_lock) {
|
|
|
|
caps_lock = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
case OPT_JOYSTICK:
|
2013-12-07 06:55:00 +00:00
|
|
|
if (joy_mode == NUM_JOYOPTS-1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
joy_mode = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++joy_mode;
|
|
|
|
}
|
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_CALIBRATE:
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
2013-10-06 08:31:58 +00:00
|
|
|
|
|
|
|
case OPT_QUIT:
|
|
|
|
break;
|
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
case OPT_REBOOT:
|
|
|
|
break;
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
default:
|
2013-07-06 04:37:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-12-15 22:59:18 +00:00
|
|
|
else if ((ch == kESC) || c_keys_is_interface_key(ch))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
timing_initialize();
|
2013-07-06 04:37:13 +00:00
|
|
|
video_set(0); /* redo colors */
|
2013-12-07 06:55:00 +00:00
|
|
|
c_initialize_sound_hooks();
|
2013-12-15 22:59:18 +00:00
|
|
|
c_interface_exit(ch);
|
2013-07-06 04:37:13 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-11-27 20:43:58 +00:00
|
|
|
else if ((ch == '?') && (option != OPT_PATH))
|
|
|
|
{
|
2013-11-30 22:14:22 +00:00
|
|
|
#define MAINHELP_SUBMENU_H 18
|
2013-11-27 20:43:58 +00:00
|
|
|
#define MAINHELP_SUBMENU_W 40
|
|
|
|
char submenu[MAINHELP_SUBMENU_H][MAINHELP_SUBMENU_W+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40.
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||",
|
2013-12-01 20:08:17 +00:00
|
|
|
"| Movement : @ and @ arrows |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"| |",
|
2013-12-01 20:08:17 +00:00
|
|
|
"| Change : @ and @ arrows to toggle |",
|
|
|
|
"| Values : or press the 'Return' |",
|
|
|
|
"| key to select |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| Hotkeys used while emulator running: |",
|
|
|
|
"| |",
|
|
|
|
"| F1 F2: Slot6 Disk Drive A, Drive B |",
|
|
|
|
"| F5 : Show Keyboard Layout |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| F7 : 6502 Debugger |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"| F9 : Toggle Emulator Speed |",
|
|
|
|
"| F10 : Main Menu |",
|
|
|
|
"| |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| Ctrl-LeftAlt-End Reboots //e |",
|
|
|
|
"| Pause/Brk : Pause Emulator |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"||||||||||||||||||||||||||||||||||||||||" };
|
2013-12-01 20:08:17 +00:00
|
|
|
submenu[ 1 ][ 14 ] = MOUSETEXT_BEGIN + 0x0b;
|
|
|
|
submenu[ 1 ][ 20 ] = MOUSETEXT_BEGIN + 0x0a;
|
|
|
|
submenu[ 3 ][ 14 ] = MOUSETEXT_BEGIN + 0x08;
|
|
|
|
submenu[ 3 ][ 20 ] = MOUSETEXT_BEGIN + 0x15;
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
c_interface_print_submenu_centered(submenu[0], MAINHELP_SUBMENU_W, MAINHELP_SUBMENU_H);
|
|
|
|
while ((ch = c_mygetch(1)) == -1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
c_interface_print_screen( screen );
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* got a normal character setting path */
|
2013-10-06 08:31:58 +00:00
|
|
|
if (ch >= ' ' && ch < 127 && option == OPT_PATH)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
strncpy(temp, disk_path, TEMPSIZE);
|
|
|
|
for (i = strlen(temp); i >= cur_pos + cur_x; i--)
|
|
|
|
{
|
|
|
|
temp[ i + 1 ] = temp[ i ];
|
|
|
|
}
|
|
|
|
|
|
|
|
temp[ cur_pos + cur_x ] = ch;
|
|
|
|
strncpy(disk_path, temp, DISKSIZE);
|
2013-11-27 20:43:58 +00:00
|
|
|
if (cur_x < INTERFACE_PATH_MAX-1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_x++;
|
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
else if (disk_path[cur_pos + cur_x] != '\0')
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_pos++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Backspace or delete setting path */
|
2013-10-06 08:31:58 +00:00
|
|
|
if ((ch == 127 || ch == 8) && (cur_pos + cur_x - 1 >= 0) && (option == OPT_PATH))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = cur_pos + cur_x - 1; disk_path[ i ] != '\0'; i++)
|
|
|
|
{
|
|
|
|
disk_path[ i ] = disk_path[ i + 1 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cur_x > 0)
|
|
|
|
{
|
|
|
|
cur_x--;
|
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
else if (cur_pos > 0)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cur_pos--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* calibrate joystick */
|
2013-10-06 08:31:58 +00:00
|
|
|
if ((ch == 13) && (option == OPT_CALIBRATE))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-11-09 21:13:27 +00:00
|
|
|
c_joystick_reset();
|
2013-07-06 04:37:13 +00:00
|
|
|
c_calibrate_joystick();
|
2013-12-22 07:55:23 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
#define QUIT_SUBMENU_H 10
|
|
|
|
#define QUIT_SUBMENU_W 40
|
2014-03-26 06:42:05 +00:00
|
|
|
{
|
|
|
|
char qsubmenu[QUIT_SUBMENU_H][QUIT_SUBMENU_W+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40.
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| Quit Emulator... |",
|
|
|
|
"| Are you sure? (Y/N) |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||" };
|
|
|
|
|
|
|
|
/* quit emulator */
|
|
|
|
if ((ch == 13) && (option == OPT_QUIT))
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2014-03-26 06:42:05 +00:00
|
|
|
int ch;
|
|
|
|
c_interface_print_submenu_centered(qsubmenu[0], QUIT_SUBMENU_W, QUIT_SUBMENU_H);
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
while ((ch = c_mygetch(1)) == -1)
|
|
|
|
{
|
|
|
|
}
|
2013-12-28 22:28:04 +00:00
|
|
|
|
2014-03-26 06:42:05 +00:00
|
|
|
ch = toupper(ch);
|
|
|
|
if (ch == 'Y')
|
|
|
|
{
|
|
|
|
save_settings();
|
|
|
|
|
|
|
|
c_eject_6( 0 );
|
|
|
|
c_interface_print_screen( screen );
|
|
|
|
c_eject_6( 1 );
|
|
|
|
c_interface_print_screen( screen );
|
2013-11-27 20:43:58 +00:00
|
|
|
#ifdef __linux__
|
2014-03-26 06:42:05 +00:00
|
|
|
LOG("Back to Linux, w00t!\n");
|
2013-11-27 20:43:58 +00:00
|
|
|
#endif
|
2014-03-26 06:42:05 +00:00
|
|
|
video_shutdown();
|
|
|
|
//audio_shutdown(); TODO : fixme ...
|
|
|
|
exit( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* reboot emulator */
|
|
|
|
if ((ch == 13) && (option == OPT_REBOOT)) {
|
|
|
|
int ch;
|
|
|
|
memcpy(qsubmenu[4]+11, "Reboot", 6);
|
|
|
|
c_interface_print_submenu_centered(qsubmenu[0], QUIT_SUBMENU_W, QUIT_SUBMENU_H);
|
|
|
|
|
|
|
|
while ((ch = c_mygetch(1)) == -1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ch = toupper(ch);
|
|
|
|
if (ch == 'Y')
|
|
|
|
{
|
2014-10-12 23:37:21 +00:00
|
|
|
cpu65_reboot();
|
2014-03-26 06:42:05 +00:00
|
|
|
c_interface_exit(ch);
|
|
|
|
return;
|
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
2013-12-15 22:59:18 +00:00
|
|
|
c_interface_credits() - Credits and politics
|
2013-06-11 07:08:15 +00:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
void c_interface_credits()
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
char screen[24][INTERFACE_SCREEN_X+1] =
|
2013-12-15 22:59:18 +00:00
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80.",
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| @ Apple //ix @ |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"| |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
2013-12-22 07:55:23 +00:00
|
|
|
"| @ @ to scroll notes - ESC to begin emulation |",
|
2013-12-15 22:59:18 +00:00
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" };
|
|
|
|
#define SCROLL_AREA_X 2
|
|
|
|
#define SCROLL_AREA_Y 5
|
|
|
|
#define SCROLL_AREA_HEIGHT 16
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
screen[ 2 ][ 33 ] = MOUSETEXT_BEGIN + 0x01;
|
|
|
|
screen[ 2 ][ 46 ] = MOUSETEXT_BEGIN + 0x00;
|
|
|
|
|
|
|
|
screen[ 22 ][ 18 ] = MOUSETEXT_BEGIN + 0x0b;
|
|
|
|
screen[ 22 ][ 20 ] = MOUSETEXT_BEGIN + 0x0a;
|
|
|
|
|
2014-01-01 19:36:27 +00:00
|
|
|
#define SCROLL_LENGTH 58
|
2013-12-22 07:55:23 +00:00
|
|
|
#define SCROLL_WIDTH (INTERFACE_SCREEN_X+1-(SCROLL_AREA_X*2))
|
|
|
|
char credits[SCROLL_LENGTH][SCROLL_WIDTH]=
|
2013-12-15 22:59:18 +00:00
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80.",
|
|
|
|
{ " ",
|
|
|
|
" An Apple //e Emulator for POSIX Systems! ",
|
|
|
|
" ",
|
2013-12-22 07:55:23 +00:00
|
|
|
" @ Press F8 any time to return here @ ",
|
|
|
|
" ",
|
|
|
|
"QUICKSTART ",
|
2013-12-15 22:59:18 +00:00
|
|
|
" ",
|
2013-12-22 07:55:23 +00:00
|
|
|
"Press F8 at any time to return to this page ",
|
|
|
|
"Press F10 to view preferences menu ",
|
|
|
|
"Press F1 to load diskette in Slot 6, Drive A ",
|
|
|
|
"Press F2 to load diskette in Slot 6, Drive B ",
|
2013-12-15 22:59:18 +00:00
|
|
|
" ",
|
|
|
|
"AUTHORS/CREDITS ",
|
|
|
|
" ",
|
|
|
|
"Copyright 1994 Alexander Jean-Claude Bottema ",
|
|
|
|
"Copyright 1995 Stephen Lee ",
|
|
|
|
"Copyright 1997, 1998 Aaron Culliney ",
|
|
|
|
"Copyright 1998, 1999, 2000 Michael Deutschmann ",
|
|
|
|
"Copyright 2013+ Aaron Culliney ",
|
|
|
|
" ",
|
|
|
|
"ADDITIONAL CREDITS ",
|
|
|
|
" ",
|
2013-12-22 07:55:23 +00:00
|
|
|
"This software uses various Free & Open Source software, including ",
|
2013-12-15 22:59:18 +00:00
|
|
|
" ",
|
2013-12-22 07:55:23 +00:00
|
|
|
" > Audio source code derived from AppleWin -- http://applewin.berlios.de ",
|
2013-12-15 22:59:18 +00:00
|
|
|
" > OpenAL audio library -- http://sourceforge.net/projects/openal-soft ",
|
2013-12-22 07:55:23 +00:00
|
|
|
" > Compression routines from the Zlib project -- http://zlib.net ",
|
2013-12-15 22:59:18 +00:00
|
|
|
" ",
|
|
|
|
"LICENSE ",
|
|
|
|
" ",
|
|
|
|
"This Apple //ix emulator source code is subject to the GNU General Public ",
|
|
|
|
"License version 2 or later (your choice) as published by the Free Software ",
|
|
|
|
"Foundation. https://fsf.org ",
|
|
|
|
" ",
|
|
|
|
"Emulator source is freely available at https://github.com/mauiaaron/apple2 ",
|
|
|
|
" ",
|
2014-01-01 19:36:27 +00:00
|
|
|
"REPORTING BUGS ",
|
|
|
|
" ",
|
|
|
|
"Bugs can be reported at https://github.com/mauiaaron/apple2/issues/ ",
|
|
|
|
" ",
|
2013-12-15 22:59:18 +00:00
|
|
|
"FREEDOM ",
|
|
|
|
" ",
|
|
|
|
"In a world increasing constrained by digital walled gardens and draconian IP",
|
|
|
|
"laws, these organizations are fighting for your computing freedom. Please ",
|
|
|
|
"consider donating to them: ",
|
|
|
|
" ",
|
|
|
|
" > Free Software Foundation -- https://fsf.org ",
|
|
|
|
" > Electronic Frontier Foundation -- https://eff.org ",
|
|
|
|
" ",
|
|
|
|
"3RD PARTY SOFTWARE ",
|
|
|
|
" ",
|
|
|
|
" > By using this software you agree to comply with all Intellectual Pooperty",
|
|
|
|
" laws in your jurisdiction ",
|
|
|
|
" ",
|
|
|
|
" > ROM images used by the emulator are copyright Apple Computer ",
|
|
|
|
" ",
|
|
|
|
" > Disk images are copyright by various third parties ",
|
|
|
|
" " };
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
video_setpage( 0 );
|
|
|
|
|
|
|
|
c_interface_translate_screen( screen );
|
2013-12-22 07:55:23 +00:00
|
|
|
c_interface_translate_screen_x_y( credits[0], SCROLL_WIDTH, SCROLL_LENGTH);
|
2013-11-27 20:43:58 +00:00
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
int pos = 0;
|
|
|
|
int ch = -1;
|
2013-12-22 07:55:23 +00:00
|
|
|
int count = -1;
|
|
|
|
unsigned int mt_idx = 0;
|
2013-12-15 22:59:18 +00:00
|
|
|
for (;;)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
ch = c_mygetch(0);
|
|
|
|
|
|
|
|
#define FLASH_APPLE_DELAY 3
|
|
|
|
count = (count+1) % FLASH_APPLE_DELAY;
|
|
|
|
if (!count)
|
2013-12-15 22:59:18 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
mt_idx = (mt_idx+1) % 2;
|
|
|
|
credits[ 3 ][ 20 ] = MOUSETEXT_BEGIN + mt_idx;
|
|
|
|
credits[ 3 ][ 55 ] = MOUSETEXT_BEGIN + ((mt_idx+1) % 2);
|
2013-12-15 22:59:18 +00:00
|
|
|
}
|
|
|
|
|
2013-12-22 07:55:23 +00:00
|
|
|
for (int i=0, p=pos; i<SCROLL_AREA_HEIGHT; i++)
|
2013-12-15 22:59:18 +00:00
|
|
|
{
|
2013-12-22 07:55:23 +00:00
|
|
|
c_interface_print(SCROLL_AREA_X, SCROLL_AREA_Y+i, 2, credits[p]);
|
|
|
|
p = (p+1) % SCROLL_LENGTH;
|
2013-12-15 22:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ch == kUP)
|
|
|
|
{
|
|
|
|
--pos;
|
|
|
|
if (pos < 0)
|
|
|
|
{
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
}
|
2013-12-30 02:07:24 +00:00
|
|
|
else if (ch == kDN)
|
2013-12-15 22:59:18 +00:00
|
|
|
{
|
|
|
|
++pos;
|
|
|
|
if (pos >= SCROLL_LENGTH-SCROLL_AREA_HEIGHT)
|
|
|
|
{
|
|
|
|
pos = SCROLL_LENGTH-SCROLL_AREA_HEIGHT-1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((ch == kESC) || c_keys_is_interface_key(ch))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2013-12-22 07:55:23 +00:00
|
|
|
|
|
|
|
static struct timespec ts = { .tv_sec=0, .tv_nsec=33333333 };
|
|
|
|
nanosleep(&ts, NULL);
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
c_interface_exit(ch);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_keyboard_layout()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void c_interface_keyboard_layout()
|
|
|
|
{
|
2013-11-27 20:43:58 +00:00
|
|
|
char screen[24][INTERFACE_SCREEN_X+1] =
|
|
|
|
//1. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80.",
|
|
|
|
{ "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| Apple //e US Keyboard Layout |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| esc del RESET |",
|
|
|
|
"| `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ backspace |",
|
|
|
|
"| tab Q W E R T Y U I O P [{ ]} \\| |",
|
|
|
|
"| caps A S D F G H J K L ;: '\" return @ |",
|
|
|
|
"| shift Z X C V B N M ,< .> /? shift @ @ |",
|
|
|
|
"| ctrl @ space @ ctrl @ |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
2014-01-01 19:36:27 +00:00
|
|
|
"| | Quick Help |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| Left Alt is @ (OpenApple) key (Joystick button 1) | F1: Disk Drive A |",
|
|
|
|
"| Right Alt is @ (ClosedApple) key (Joystick button 2) | F2: Disk Drive B |",
|
|
|
|
"| End is //e RESET key | F5: This Menu |",
|
2014-01-01 19:36:27 +00:00
|
|
|
"| | F8: Credits |",
|
2013-11-30 22:14:22 +00:00
|
|
|
"| Ctrl-End triggers //e reset vector |F10: Options |",
|
|
|
|
"| Ctrl-LeftAlt-End triggers //e reboot ||||||||||||||||||||",
|
|
|
|
"| Ctrl-RightAlt-End triggers //e system test |",
|
|
|
|
"| |",
|
|
|
|
"| Pause/Break key pauses emulation |",
|
|
|
|
"| |",
|
2013-11-27 20:43:58 +00:00
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",
|
|
|
|
"| (Press any key to exit) |",
|
|
|
|
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" };
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
video_setpage( 0 );
|
|
|
|
|
2013-12-01 20:08:17 +00:00
|
|
|
screen[ 6 ][ 68 ] = MOUSETEXT_BEGIN + 0x0b;
|
|
|
|
screen[ 7 ][ 67 ] = MOUSETEXT_BEGIN + 0x08;
|
|
|
|
screen[ 7 ][ 69 ] = MOUSETEXT_BEGIN + 0x15;
|
|
|
|
screen[ 8 ][ 68 ] = MOUSETEXT_BEGIN + 0x0a;
|
2013-11-30 22:14:22 +00:00
|
|
|
|
2013-12-01 20:08:17 +00:00
|
|
|
screen[ 8 ][ 25 ] = MOUSETEXT_BEGIN + 0x01;
|
|
|
|
screen[ 8 ][ 47 ] = MOUSETEXT_BEGIN + 0x00;
|
|
|
|
screen[ 11 ][ 14 ] = MOUSETEXT_BEGIN + 0x01;
|
|
|
|
screen[ 12 ][ 15 ] = MOUSETEXT_BEGIN + 0x00;
|
2013-11-30 22:14:22 +00:00
|
|
|
|
2013-11-27 20:43:58 +00:00
|
|
|
c_interface_translate_screen(screen);
|
|
|
|
c_interface_print_screen( screen );
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
int ch = -1;
|
|
|
|
while ((ch = c_mygetch(1)) == -1)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-12-15 22:59:18 +00:00
|
|
|
c_interface_exit(ch);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-09-17 03:42:07 +00:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_interface_begin()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
static void *interface_thread(void *current_key)
|
|
|
|
{
|
|
|
|
pthread_mutex_lock(&interface_mutex);
|
|
|
|
#ifdef AUDIO_ENABLED
|
|
|
|
SoundSystemPause();
|
|
|
|
#endif
|
|
|
|
in_interface = true;
|
|
|
|
|
2014-10-31 17:53:10 +00:00
|
|
|
switch ((__SWORD_TYPE)current_key) {
|
2014-09-17 03:42:07 +00:00
|
|
|
#ifdef INTERFACE_CLASSIC
|
|
|
|
case kF1:
|
|
|
|
c_interface_select_diskette( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kF2:
|
|
|
|
c_interface_select_diskette( 1 );
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case kPAUSE:
|
|
|
|
while (c_mygetch(1) == -1)
|
|
|
|
{
|
2014-11-02 21:46:30 +00:00
|
|
|
struct timespec ts = { .tv_sec=0, .tv_nsec=33333333/*30Hz*/ };
|
2014-09-17 03:42:07 +00:00
|
|
|
nanosleep(&ts, NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef INTERFACE_CLASSIC
|
|
|
|
case kF5:
|
|
|
|
c_interface_keyboard_layout();
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef DEBUGGER
|
|
|
|
case kF7:
|
|
|
|
c_interface_debugging();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case kF8:
|
|
|
|
c_interface_credits();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kF10:
|
|
|
|
c_interface_parameters();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef AUDIO_ENABLED
|
|
|
|
SoundSystemUnpause();
|
|
|
|
#endif
|
|
|
|
c_joystick_reset();
|
|
|
|
pthread_mutex_unlock(&interface_mutex);
|
|
|
|
in_interface = false;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void c_interface_begin(int current_key)
|
|
|
|
{
|
|
|
|
pthread_t t = 0;
|
2014-10-25 15:44:21 +00:00
|
|
|
pthread_create(&t, NULL, (void *)&interface_thread, (void *)((__SWORD_TYPE)current_key));
|
2014-09-17 03:42:07 +00:00
|
|
|
}
|
|
|
|
|