New style for info message.
This commit is contained in:
@@ -185,6 +185,8 @@ unsigned char charfont[][8] =
|
||||
{ 0x08,0x08,0x08,0x0F,0x00,0x00,0x00,0x00 }, // 138 [0x8A] BR
|
||||
{ 0x00,0x00,0x00,0x0F,0x08,0x08,0x08,0x08 }, // 139 [0x8B] BL
|
||||
|
||||
{ 0x7F,0x41,0x41,0x41,0x41,0x41,0x7F,0x00 }, // 140 [0x8C] empty square
|
||||
{ 0x1C,0x1C,0x3E,0x7F,0x00,0x2A,0x49,0x00 }, // 141 [0x8D] speaker
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
18
input.c
18
input.c
@@ -1446,8 +1446,9 @@ static void joy_digital(int num, uint16_t mask, char press, int bnum)
|
||||
if (autofire[num] & amask) autofire[num] &= ~amask;
|
||||
else autofire[num] |= amask;
|
||||
|
||||
InfoMessage((autofire[num] & amask) ? "\n\n Auto fire\n ON" :
|
||||
"\n\n Auto fire\n OFF");
|
||||
if(hasAPI1_5()) Info((autofire[num] & amask) ? "\n Auto fire: ON" : "\n Auto fire: OFF", 16, 3);
|
||||
else InfoMessage((autofire[num] & amask) ? "\n\n Auto fire\n ON" :
|
||||
"\n\n Auto fire\n OFF");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1456,8 +1457,17 @@ static void joy_digital(int num, uint16_t mask, char press, int bnum)
|
||||
else if (joy[num] & 4) af_delay[num] = 200;
|
||||
else af_delay[num] = 500;
|
||||
static char str[256];
|
||||
sprintf(str, "\n\n Auto fire period\n %dms", af_delay[num] * 2);
|
||||
InfoMessage(str);
|
||||
|
||||
if (hasAPI1_5())
|
||||
{
|
||||
sprintf(str, "\n Auto fire period: %d ms", af_delay[num] * 2);
|
||||
Info(str, 27, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str, "\n\n Auto fire period\n %dms", af_delay[num] * 2);
|
||||
InfoMessage(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
20
menu.c
20
menu.c
@@ -3630,13 +3630,19 @@ void InfoMessageEx(char *message, int timeout)
|
||||
menu_timer = GetTimer(timeout);
|
||||
}
|
||||
|
||||
void EjectAllFloppies()
|
||||
void InfoEx(char *message, int width, int height, int timeout)
|
||||
{
|
||||
char i;
|
||||
for (i = 0; i<drives; i++)
|
||||
df[i].status = 0;
|
||||
if (!user_io_osd_is_visible())
|
||||
{
|
||||
OSD_PrintInfo(message, width, height, 0);
|
||||
InfoEnable(20, 10, width, height);
|
||||
|
||||
// harddisk
|
||||
config.hardfile[0].present = 0;
|
||||
config.hardfile[1].present = 0;
|
||||
menu_timer = GetTimer(timeout);
|
||||
menustate = MENU_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
void Info(char *message, int width, int height)
|
||||
{
|
||||
InfoEx(message, width, height, 2000);
|
||||
}
|
||||
|
||||
3
menu.h
3
menu.h
@@ -20,9 +20,10 @@ void ScrollLongName(void);
|
||||
void ErrorMessage(const char *message, unsigned char code);
|
||||
void InfoMessage(char *message);
|
||||
void InfoMessageEx(char *message, int timeout);
|
||||
void InfoEx(char *message, int width, int height, int timeout);
|
||||
void Info(char *message, int width, int height);
|
||||
void ShowSplash();
|
||||
void HideSplash();
|
||||
void EjectAllFloppies();
|
||||
|
||||
unsigned long getStatus(char *opt, unsigned long status);
|
||||
|
||||
|
||||
90
osd.c
90
osd.c
@@ -458,6 +458,71 @@ void OSD_PrintText(unsigned char line, char *text, unsigned long start, unsigned
|
||||
DisableOsd();
|
||||
}
|
||||
|
||||
#define INFO_MAXW 32
|
||||
#define INFO_MAXH 16
|
||||
|
||||
void OSD_PrintInfo(char *message, int width, int height, int frame)
|
||||
{
|
||||
static char str[INFO_MAXW * INFO_MAXH];
|
||||
|
||||
if (!width || !height) return;
|
||||
|
||||
memset(str, ' ', sizeof(str));
|
||||
if (width > INFO_MAXW) width = INFO_MAXW;
|
||||
if (height > INFO_MAXH) height = INFO_MAXH;
|
||||
|
||||
int x = 0, y = 0;
|
||||
while (*message)
|
||||
{
|
||||
char c = *message++;
|
||||
if (c == 0xD) continue;
|
||||
if (c == 0xA)
|
||||
{
|
||||
x = 0;
|
||||
y++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (x < INFO_MAXW && y < INFO_MAXH) str[(y*INFO_MAXW) + x] = c;
|
||||
x++;
|
||||
}
|
||||
|
||||
if (frame)
|
||||
{
|
||||
frame = (frame - 1) * 6;
|
||||
for (x = 1; x < width - 1; x++)
|
||||
{
|
||||
str[(0 * INFO_MAXW) + x] = 0x81+frame;
|
||||
str[((height - 1)*INFO_MAXW) + x] = 0x81 + frame;
|
||||
}
|
||||
for (y = 1; y < height - 1; y++)
|
||||
{
|
||||
str[(y * INFO_MAXW)] = 0x83 + frame;
|
||||
str[(y * INFO_MAXW) + width - 1] = 0x83 + frame;
|
||||
}
|
||||
str[0] = 0x80 + frame;
|
||||
str[width - 1] = 0x82 + frame;
|
||||
str[(height - 1)*INFO_MAXW] = 0x85 + frame;
|
||||
str[((height - 1)*INFO_MAXW) + width - 1] = 0x84 + frame;
|
||||
}
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
if (!is_minimig())
|
||||
spi_osd_cmd_cont(MM1_OSDCMDWRITE | y);
|
||||
else
|
||||
spi_osd_cmd32_cont(OSD_CMD_OSD_WR, y);
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
const unsigned char *p = charfont[str[(y*INFO_MAXW) + x]];
|
||||
for (int i = 0; i < 8; i++) spi8(*p++);
|
||||
}
|
||||
|
||||
DisableOsd();
|
||||
}
|
||||
}
|
||||
|
||||
// clear OSD frame buffer
|
||||
void OsdClear(void)
|
||||
{
|
||||
@@ -477,10 +542,31 @@ void OsdEnable(unsigned char mode)
|
||||
{
|
||||
user_io_osd_key_enable(mode & DISABLE_KEYBOARD);
|
||||
|
||||
mode &= DISABLE_KEYBOARD;
|
||||
|
||||
if (!is_minimig()) spi_osd_cmd(MM1_OSDCMDENABLE | mode);
|
||||
else spi_osd_cmd8(OSD_CMD_OSD, 0x01 | mode);
|
||||
}
|
||||
|
||||
void InfoEnable(int x, int y, int width, int height)
|
||||
{
|
||||
user_io_osd_key_enable(0);
|
||||
|
||||
if (!is_minimig())
|
||||
spi_osd_cmd(MM1_OSDCMDENABLE | (mode & DISABLE_KEYBOARD));
|
||||
{
|
||||
spi_osd_cmd_cont(MM1_OSDCMDENABLE | OSD_INFO);
|
||||
}
|
||||
else
|
||||
spi_osd_cmd8(OSD_CMD_OSD, 0x01 | (mode & DISABLE_KEYBOARD));
|
||||
{
|
||||
spi_osd_cmd_cont(OSD_CMD_OSD);
|
||||
spi8(1 | OSD_INFO);
|
||||
}
|
||||
|
||||
spi_w(x);
|
||||
spi_w(y);
|
||||
spi_w(width);
|
||||
spi_w(height);
|
||||
DisableOsd();
|
||||
}
|
||||
|
||||
// disable displaying of OSD
|
||||
|
||||
3
osd.h
3
osd.h
@@ -45,6 +45,7 @@
|
||||
#define OSD_CMD_VERSION 0x88
|
||||
|
||||
#define DISABLE_KEYBOARD 0x02 // disable keyboard while OSD is active
|
||||
#define OSD_INFO 0x04 // display info
|
||||
|
||||
#define REPEATDELAY 500 // repeat delay in 1ms units
|
||||
#define REPEATRATE 50 // repeat rate in 1ms units
|
||||
@@ -70,6 +71,7 @@ void OsdWrite(unsigned char n, char *s, unsigned char inver, unsigned char stipp
|
||||
void OsdWriteOffset(unsigned char n, char *s, unsigned char inver, unsigned char stipple, char offset, char leftchar); // Used for scrolling "Exit" text downwards...
|
||||
void OsdClear(void);
|
||||
void OsdEnable(unsigned char mode);
|
||||
void InfoEnable(int x, int y, int width, int height);
|
||||
void OsdDisable(void);
|
||||
void ConfigFilter(unsigned char lores, unsigned char hires);
|
||||
void ConfigVideo(unsigned char hires, unsigned char lores, unsigned char scanlines);
|
||||
@@ -80,6 +82,7 @@ void ConfigChipset(unsigned char chipset);
|
||||
void ConfigFloppy(unsigned char drives, unsigned char speed);
|
||||
void ConfigAutofire(unsigned char autofire, unsigned char mask);
|
||||
void OSD_PrintText(unsigned char line, char *text, unsigned long start, unsigned long width, unsigned long offset, unsigned char invert);
|
||||
void OSD_PrintInfo(char *message, int width, int height, int frame);
|
||||
void OsdDrawLogo(unsigned char n, char row, char superimpose);
|
||||
void ScrollText(char n, const char *str, int off, int len, int max_len, unsigned char invert);
|
||||
void ScrollReset();
|
||||
|
||||
41
user_io.c
41
user_io.c
@@ -65,7 +65,7 @@ bool scrl_status = 0;
|
||||
|
||||
// set by OSD code to suppress forwarding of those keys to the core which
|
||||
// may be in use by an active OSD
|
||||
static char osd_is_visible = false;
|
||||
static char osd_is_visible = 0;
|
||||
|
||||
char user_io_osd_is_visible()
|
||||
{
|
||||
@@ -968,6 +968,12 @@ void user_io_rtc_reset()
|
||||
rtc_timer = 0;
|
||||
}
|
||||
|
||||
static int api1_5 = 0;
|
||||
int hasAPI1_5()
|
||||
{
|
||||
return api1_5;
|
||||
}
|
||||
|
||||
static int coldreset_req = 0;
|
||||
|
||||
int adjust_video_mode(uint32_t vtime);
|
||||
@@ -998,6 +1004,7 @@ uint32_t show_video_info(int force)
|
||||
printf("\033[1;33mINFO: Video resolution: %u x %u, fHorz = %.1fKHz, fVert = %.1fHz, fPix = %.2fMHz\033[0m\n", width, height, hrate, vrate, prate);
|
||||
printf("\033[1;33mINFO: Frame time (100MHz counter): VGA = %d, HDMI = %d\033[0m\n", vtime, vtimeh);
|
||||
|
||||
if (vtimeh) api1_5 = 1;
|
||||
if (vtime && vtimeh) return vtime;
|
||||
}
|
||||
else
|
||||
@@ -1825,24 +1832,26 @@ static char key_used_by_osd(uint32_t s)
|
||||
return osd_is_visible;
|
||||
}
|
||||
|
||||
void set_volume()
|
||||
static void set_volume()
|
||||
{
|
||||
vol_set_timeout = GetTimer(1000);
|
||||
|
||||
spi_uio_cmd8(UIO_AUDVOL, vol_att);
|
||||
if (vol_att & 0x10)
|
||||
{
|
||||
InfoMessageEx("\n\n Audio muted", 1000);
|
||||
InfoEx("\n \x8d Mute", 8, 3, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
char str[64];
|
||||
char str[32];
|
||||
memset(str, 0, sizeof(str));
|
||||
|
||||
int vol = vol_att & 0xf;
|
||||
sprintf(str, "\n\n Volume %d dB\n ", -3*vol);
|
||||
memset(str + strlen(str), 0x7f, 16-vol);
|
||||
InfoMessageEx(str, 1000);
|
||||
sprintf(str, "\n \x8d ");
|
||||
char *bar = str + strlen(str);
|
||||
memset(bar, 0x8C, 16);
|
||||
memset(bar, 0x7f, 16 - vol);
|
||||
InfoEx(str, 20, 3, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1850,7 +1859,7 @@ void user_io_kbd(uint16_t key, int press)
|
||||
{
|
||||
if (key == KEY_MUTE)
|
||||
{
|
||||
if (press == 1 && !osd_is_visible && !is_menu_core())
|
||||
if (press == 1 && hasAPI1_5() && !osd_is_visible && !is_menu_core())
|
||||
{
|
||||
vol_att ^= 0x10;
|
||||
set_volume();
|
||||
@@ -1859,7 +1868,7 @@ void user_io_kbd(uint16_t key, int press)
|
||||
else
|
||||
if (key == KEY_VOLUMEDOWN)
|
||||
{
|
||||
if (press && !osd_is_visible && !is_menu_core())
|
||||
if (press && hasAPI1_5() && !osd_is_visible && !is_menu_core())
|
||||
{
|
||||
if(vol_att & 0x10) vol_att ^= 0x10;
|
||||
else if((vol_att & 0xF) < 15) vol_att += 1;
|
||||
@@ -1869,7 +1878,7 @@ void user_io_kbd(uint16_t key, int press)
|
||||
else
|
||||
if (key == KEY_VOLUMEUP)
|
||||
{
|
||||
if (press && !osd_is_visible && !is_menu_core())
|
||||
if (press && hasAPI1_5() && !osd_is_visible && !is_menu_core())
|
||||
{
|
||||
if (vol_att & 0x10) vol_att ^= 0x10;
|
||||
else if(vol_att & 0xF) vol_att -= 1;
|
||||
@@ -1879,20 +1888,12 @@ void user_io_kbd(uint16_t key, int press)
|
||||
else
|
||||
if (key == 0xBE)
|
||||
{
|
||||
if (press)
|
||||
{
|
||||
setBrightness(BRIGHTNESS_DOWN, 0);
|
||||
vol_set_timeout = GetTimer(1000);
|
||||
}
|
||||
if (press) setBrightness(BRIGHTNESS_DOWN, 0);
|
||||
}
|
||||
else
|
||||
if (key == 0xBF)
|
||||
{
|
||||
if (press)
|
||||
{
|
||||
setBrightness(BRIGHTNESS_UP, 0);
|
||||
vol_set_timeout = GetTimer(1000);
|
||||
}
|
||||
if (press) setBrightness(BRIGHTNESS_UP, 0);
|
||||
}
|
||||
else
|
||||
if ((core_type == CORE_TYPE_MINIMIG2) ||
|
||||
|
||||
Reference in New Issue
Block a user