mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-02-03 14:53:05 +00:00
Merge commit 'd37127485acc27491dfb5d07d74b0553b45ba8c7' into firmware_160610
This commit is contained in:
13
charrom.h
13
charrom.h
@@ -24,6 +24,17 @@ Write enable
|
||||
. . . . . . . .
|
||||
0x70,0x70,0x70,0x70,0x7c,0x72,0x02,0x0c
|
||||
|
||||
Middle Dot
|
||||
. . . . . . . .
|
||||
. . . . . . . .
|
||||
. . . * * . . .
|
||||
. . . * * . . .
|
||||
. . . . . . . .
|
||||
. . . . . . . .
|
||||
. . . . . . . .
|
||||
. . . . . . . .
|
||||
0x00,0x00,0x00,0x0c,0x0c,0x00,0x00,0x00
|
||||
|
||||
*/
|
||||
|
||||
// *character font
|
||||
@@ -56,7 +67,7 @@ unsigned char charfont[128][8] =
|
||||
{0x70,0x70,0x70,0x70,0x7c,0x72,0x02,0x0c}, // 24 [0x18] write enable
|
||||
{0x3e,0x3e,0x22,0x22,0x22,0x3e,0x3e,0x00}, // 25 [0x19] unchecked checkbox
|
||||
{0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x00}, // 26 [0x1a] checked checkbox
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 27 [0x1b]
|
||||
{0x00,0x00,0x00,0x0c,0x0c,0x00,0x00,0x00}, // 27 [0x1b] middle dot
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 28 [0x1c]
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 29 [0x1d]
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 30 [0x1e]
|
||||
|
||||
106
menu.c
106
menu.c
@@ -87,8 +87,8 @@ extern char DirEntryLFN[MAXDIRENTRIES][261];
|
||||
char DirEntryInfo[MAXDIRENTRIES][5]; // disk number info of dir entries
|
||||
char DiskInfo[5]; // disk number info of selected entry
|
||||
|
||||
extern const char version[];
|
||||
|
||||
extern const char version[];
|
||||
const char *config_tos_mem[] = {"512 kB", "1 MB", "2 MB", "4 MB", "8 MB", "14 MB", "--", "--" };
|
||||
const char *config_tos_wrprot[] = {"none", "A:", "B:", "A: and B:"};
|
||||
const char *config_tos_usb[] = {"none", "control", "debug", "serial", "parallel", "midi"};
|
||||
@@ -243,22 +243,20 @@ static void substrcpy(char *d, char *s, char idx) {
|
||||
#define HELPTEXT_DELAY 10000
|
||||
#define FRAME_DELAY 150
|
||||
|
||||
//assumes big endian
|
||||
// prints input as a string of binary (on/off) values
|
||||
// assumes big endian, returns using special characters (checked box/unchecked box)
|
||||
void siprintbinary(char* buffer, size_t const size, void const * const ptr)
|
||||
{
|
||||
unsigned char *b = (unsigned char*) ptr;
|
||||
unsigned char byte;
|
||||
int i, j;
|
||||
siprintf(buffer, "%*s", size-1, "");
|
||||
memset(buffer, '\0', size);
|
||||
for (i=size-1;i>=0;i--)
|
||||
{
|
||||
for (j=0;j<8;j++)
|
||||
{
|
||||
byte = (b[i] >> j) & 1;
|
||||
if(byte)
|
||||
strcat(buffer, "1");
|
||||
else
|
||||
strcat(buffer, "0");
|
||||
buffer[j]=byte?'\x1a':'\x19';
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -279,6 +277,7 @@ void get_joystick_state( char *joy_string, char *joy_string2, unsigned int joy_n
|
||||
if (vjoy==0) {
|
||||
memset(joy_string2, ' ', 8);
|
||||
memset(joy_string2+8, '\x14', 1);
|
||||
memset(joy_string2+9, ' ', 1);
|
||||
return;
|
||||
}
|
||||
strcpy(joy_string, " \x12 X Y L R L2 R2 L3");
|
||||
@@ -299,7 +298,6 @@ void get_joystick_state( char *joy_string, char *joy_string2, unsigned int joy_n
|
||||
if(!(vjoy & JOY_SELECT))memset(joy_string2+16, ' ', 3);
|
||||
if(!(vjoy & JOY_START)) memset(joy_string2+20, ' ', 3);
|
||||
if(!(vjoy & JOY_R3)) memset(joy_string2+24, ' ', 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -308,37 +306,46 @@ void get_joystick_state_usb( char *s, unsigned char joy_num ) {
|
||||
(in reverse binary format to correspont to MIST.INI mapping entries)
|
||||
*/
|
||||
char buffer[5];
|
||||
unsigned short i;
|
||||
char binary_string[9]="00000000";
|
||||
unsigned char joy = 0;
|
||||
unsigned int max_btn = 1;
|
||||
if (OsdNumJoysticks()==0 || (joy_num==1 && OsdNumJoysticks()<2))
|
||||
{
|
||||
strcpy( s, " ");
|
||||
return;
|
||||
}
|
||||
char binary_string[9]="00000000";
|
||||
unsigned char joy = 0;
|
||||
if(joy_num==0)
|
||||
if(joy_num==0) {
|
||||
joy = OsdUsbJoyGet();
|
||||
else
|
||||
max_btn = OsdUsbGetNumButtons();
|
||||
}
|
||||
else {
|
||||
joy = OsdUsbJoyGetB();
|
||||
siprintf(s, " USB: ");
|
||||
max_btn = OsdUsbGetNumButtonsB();
|
||||
}
|
||||
siprintf(s, " USB: ---- 0000 0000 0000");
|
||||
siprintbinary(binary_string, sizeof(joy), &joy);
|
||||
binary_string[0]=binary_string[0]=='1'?'>':'-';
|
||||
binary_string[1]=binary_string[1]=='1'?'<':'-';
|
||||
binary_string[2]=binary_string[2]=='1'?'\x13':'-';
|
||||
binary_string[3]=binary_string[3]=='1'?'\x12':'-';
|
||||
|
||||
memcpy( buffer, &binary_string[0], 4 );
|
||||
buffer[4]='\0';
|
||||
strcat(s, buffer );
|
||||
strcat(s, " ");
|
||||
memcpy( buffer, &binary_string[4], 4 );
|
||||
buffer[4]='\0';
|
||||
strcat(s, buffer );
|
||||
s[7] = binary_string[0]=='\x1a'?'>':'\x1b';
|
||||
s[8] = binary_string[1]=='\x1a'?'<':'\x1b';
|
||||
s[9] = binary_string[2]=='\x1a'?'\x13':'\x1b';
|
||||
s[10] = binary_string[3]=='\x1a'?'\x12':'\x1b';
|
||||
s[12] = binary_string[4];
|
||||
s[13] = max_btn>1 ? binary_string[5] : ' ';
|
||||
s[14] = max_btn>2 ? binary_string[6] : ' ';
|
||||
s[15] = max_btn>3 ? binary_string[7] : ' ';
|
||||
if(joy_num==0)
|
||||
joy = OsdUsbJoyGetExtra();
|
||||
else
|
||||
joy = OsdUsbJoyGetExtraB();
|
||||
siprintbinary(binary_string, sizeof(joy), &joy);
|
||||
strcat(s, binary_string);
|
||||
s[17] = max_btn>4 ? binary_string[0] : ' ';
|
||||
s[18] = max_btn>5 ? binary_string[1] : ' ';
|
||||
s[19] = max_btn>6 ? binary_string[2] : ' ';
|
||||
s[20] = max_btn>7 ? binary_string[3] : ' ';
|
||||
s[22] = max_btn>8 ? binary_string[4] : ' ';
|
||||
s[23] = max_btn>9 ? binary_string[5] : ' ';
|
||||
s[24] = max_btn>10 ? binary_string[6] : ' ';
|
||||
s[25] = max_btn>11 ? binary_string[7] : ' ';
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1040,6 +1047,7 @@ void HandleUI(void)
|
||||
case MENU_8BIT_CONTROLLERS1:
|
||||
helptext = helptexts[HELPTEXT_NONE];
|
||||
menumask=0x1f;
|
||||
//menumask=0x3f;
|
||||
OsdSetTitle("Inputs", 0);
|
||||
menustate = MENU_8BIT_CONTROLLERS2;
|
||||
parentstate=MENU_8BIT_CONTROLLERS1;
|
||||
@@ -1049,8 +1057,10 @@ void HandleUI(void)
|
||||
OsdWrite(3, " Keyboard Test \x16", menusub==2, 0);
|
||||
OsdWrite(4, " USB status \x16", menusub==3, 0);
|
||||
OsdWrite(5, "", 0, 0);
|
||||
//OsdWrite(5, " CHR test \x16", menusub==4, 0);
|
||||
OsdWrite(6, "", 0, 0);
|
||||
OsdWrite(7, STD_EXIT, menusub==4, 0);
|
||||
//OsdWrite(7, STD_EXIT, menusub==5, 0);
|
||||
break;
|
||||
|
||||
case MENU_8BIT_CONTROLLERS2:
|
||||
@@ -1079,6 +1089,12 @@ void HandleUI(void)
|
||||
menustate=MENU_8BIT_USB1;
|
||||
menusub = 0;
|
||||
break;
|
||||
/*case 4:
|
||||
// character rom test
|
||||
menustate=MENU_8BIT_CHRTEST1;
|
||||
menusub = 0;
|
||||
break;
|
||||
*/
|
||||
case 4:
|
||||
// Exit to system menu
|
||||
menustate=MENU_8BIT_SYSTEM1;
|
||||
@@ -1256,6 +1272,44 @@ void HandleUI(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_8BIT_CHRTEST1:
|
||||
helptext = helptexts[HELPTEXT_NONE];
|
||||
menumask=0;
|
||||
OsdSetTitle("CHR", 0);
|
||||
menustate = MENU_8BIT_CHRTEST2;
|
||||
parentstate=MENU_8BIT_CHRTEST1;
|
||||
strcpy(usb_id, " ");
|
||||
for(i=1; i<24; i++) {
|
||||
if(i<4 || i>13)
|
||||
usb_id[i] = i;
|
||||
else
|
||||
usb_id[i] = ' ';
|
||||
}
|
||||
OsdWrite(0, usb_id, 0, 0);
|
||||
for(i=0; i<24; i++) usb_id[i] = i+24;
|
||||
OsdWrite(1, usb_id, 0, 0);
|
||||
for(i=0; i<24; i++) usb_id[i] = i+(24*2);
|
||||
OsdWrite(2, usb_id, 0, 0);
|
||||
for(i=0; i<24; i++) usb_id[i] = i+(24*3);
|
||||
OsdWrite(3, usb_id, 0, 0);
|
||||
for(i=0; i<24; i++) usb_id[i] = i+(24*4);
|
||||
OsdWrite(4, usb_id, 0, 0);
|
||||
strcpy(usb_id, " ");
|
||||
for(i=0; i<8; i++) usb_id[i] = i+(24*5);
|
||||
OsdWrite(5, usb_id, 0, 0);
|
||||
//for(i=0; i<24; i++) usb_id[i] = i+(24*6);
|
||||
OsdWrite(6, "", 0, 0);
|
||||
OsdWrite(7, STD_SPACE_EXIT, menusub==0, 0);
|
||||
break;
|
||||
|
||||
case MENU_8BIT_CHRTEST2:
|
||||
|
||||
if(c==KEY_SPACE) {
|
||||
menustate = MENU_8BIT_CONTROLLERS1;
|
||||
menusub = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
/******************************************************************/
|
||||
/* mist main menu */
|
||||
/******************************************************************/
|
||||
|
||||
5
menu.h
5
menu.h
@@ -104,7 +104,10 @@ enum MENU
|
||||
MENU_8BIT_KEYTEST1,
|
||||
MENU_8BIT_KEYTEST2,
|
||||
MENU_8BIT_USB1,
|
||||
MENU_8BIT_USB2
|
||||
MENU_8BIT_USB2,
|
||||
MENU_8BIT_CHRTEST1,
|
||||
MENU_8BIT_CHRTEST2
|
||||
|
||||
};
|
||||
|
||||
// UI strings, used by boot messages
|
||||
|
||||
14
osd.c
14
osd.c
@@ -794,9 +794,11 @@ uint8_t OsdUsbJoyGetExtraB() {
|
||||
/* connected HID information */
|
||||
static unsigned int usb_vid;
|
||||
static unsigned int usb_pid;
|
||||
void OsdUsbIdSet(unsigned int vid, unsigned int pid) {
|
||||
static unsigned int num_buttons;
|
||||
void OsdUsbIdSet(unsigned int vid, unsigned int pid, unsigned int num) {
|
||||
usb_vid=vid;
|
||||
usb_pid=pid;
|
||||
num_buttons = num;
|
||||
}
|
||||
unsigned int OsdUsbVidGet() {
|
||||
return usb_vid;
|
||||
@@ -804,13 +806,18 @@ unsigned int OsdUsbVidGet() {
|
||||
unsigned int OsdUsbPidGet() {
|
||||
return usb_pid;
|
||||
}
|
||||
unsigned int OsdUsbGetNumButtons() {
|
||||
return num_buttons;
|
||||
}
|
||||
|
||||
/* connected HID information - joy 2*/
|
||||
static unsigned int usb_vid_b;
|
||||
static unsigned int usb_pid_b;
|
||||
void OsdUsbIdSetB(unsigned int vid, unsigned int pid) {
|
||||
static unsigned int num_buttons_b;
|
||||
void OsdUsbIdSetB(unsigned int vid, unsigned int pid, unsigned int num) {
|
||||
usb_vid_b=vid;
|
||||
usb_pid_b=pid;
|
||||
num_buttons_b = num;
|
||||
}
|
||||
unsigned int OsdUsbVidGetB() {
|
||||
return usb_vid_b;
|
||||
@@ -818,6 +825,9 @@ unsigned int OsdUsbVidGetB() {
|
||||
unsigned int OsdUsbPidGetB() {
|
||||
return usb_pid_b;
|
||||
}
|
||||
unsigned int OsdUsbGetNumButtonsB() {
|
||||
return num_buttons_b;
|
||||
}
|
||||
|
||||
/* keyboard data */
|
||||
static unsigned char key_modifier = 0;
|
||||
|
||||
7
osd.h
7
osd.h
@@ -156,17 +156,20 @@ unsigned char OsdNumJoysticksSet(unsigned char num);
|
||||
void OsdUsbJoySet(uint8_t usbjoy, uint8_t usbextra);
|
||||
uint8_t OsdUsbJoyGet();
|
||||
uint8_t OsdUsbJoyGetExtra();
|
||||
void OsdUsbIdSet(unsigned int vid, unsigned int pid);
|
||||
void OsdUsbIdSet(unsigned int vid, unsigned int pid, unsigned int num_buttons);
|
||||
unsigned int OsdUsbVidGet();
|
||||
unsigned int OsdUsbPidGet();
|
||||
unsigned int OsdUsbGetNumButtons();
|
||||
|
||||
|
||||
// USB raw data for joystick 2
|
||||
void OsdUsbJoySetB(uint8_t usbjoy, uint8_t usbextra);
|
||||
uint8_t OsdUsbJoyGetB();
|
||||
uint8_t OsdUsbJoyGetExtraB();
|
||||
void OsdUsbIdSetB(unsigned int vid, unsigned int pid);
|
||||
void OsdUsbIdSetB(unsigned int vid, unsigned int pid, unsigned int num_buttons);
|
||||
unsigned int OsdUsbVidGetB();
|
||||
unsigned int OsdUsbPidGetB();
|
||||
unsigned int OsdUsbGetNumButtonsB();
|
||||
|
||||
// get/set core currently loaded
|
||||
void OsdCoreNameSet(const char* str);
|
||||
|
||||
@@ -737,10 +737,10 @@ static void usb_process_iface (usb_hid_iface_info_t *iface,
|
||||
|
||||
// report joystick 1 to OSD
|
||||
if ( iface->jindex==0) {
|
||||
OsdUsbIdSet( conf->joystick_mouse.vid, conf->joystick_mouse.pid );
|
||||
OsdUsbIdSet( conf->joystick_mouse.vid, conf->joystick_mouse.pid, conf->joystick_mouse.button_count );
|
||||
OsdUsbJoySet( jmap, btn_extra );
|
||||
} else if (iface->jindex==1) {
|
||||
OsdUsbIdSetB( conf->joystick_mouse.vid, conf->joystick_mouse.pid );
|
||||
OsdUsbIdSetB( conf->joystick_mouse.vid, conf->joystick_mouse.pid, conf->joystick_mouse.button_count );
|
||||
OsdUsbJoySetB( jmap, btn_extra );
|
||||
}
|
||||
// map virtual joypad
|
||||
|
||||
@@ -130,21 +130,21 @@ bool parse_report_descriptor(uint8_t *rep, uint16_t rep_size, hid_report_t *conf
|
||||
// we are currently skipping an unknown/unsupported collection)
|
||||
if(skip_collection) {
|
||||
if(!type) { // main item
|
||||
// any new collection increases the depth of collections to skip
|
||||
if(tag == 10) {
|
||||
skip_collection++;
|
||||
collection_depth++;
|
||||
}
|
||||
// any new collection increases the depth of collections to skip
|
||||
if(tag == 10) {
|
||||
skip_collection++;
|
||||
collection_depth++;
|
||||
}
|
||||
|
||||
// any end collection decreases it
|
||||
if(tag == 12) {
|
||||
skip_collection--;
|
||||
collection_depth--;
|
||||
// any end collection decreases it
|
||||
if(tag == 12) {
|
||||
skip_collection--;
|
||||
collection_depth--;
|
||||
|
||||
// leaving the depth the generic desktop was valid for
|
||||
if(generic_desktop > collection_depth)
|
||||
generic_desktop = -1;
|
||||
}
|
||||
// leaving the depth the generic desktop was valid for
|
||||
if(generic_desktop > collection_depth)
|
||||
generic_desktop = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@ bool parse_report_descriptor(uint8_t *rep, uint16_t rep_size, hid_report_t *conf
|
||||
conf->joystick_mouse.button[b].byte_offset = this_bit/8;
|
||||
conf->joystick_mouse.button[b].bitmask = 1 << (this_bit%8);
|
||||
}
|
||||
conf->joystick_mouse.button_count = report_count * report_size;
|
||||
}
|
||||
|
||||
// we found at least one button which is all we want to accept this as a valid
|
||||
@@ -345,7 +346,7 @@ bool parse_report_descriptor(uint8_t *rep, uint16_t rep_size, hid_report_t *conf
|
||||
case 7:
|
||||
hidp_extreme_debugf("REPORT_SIZE(%d)", value);
|
||||
report_size = value;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
hidp_extreme_debugf("REPORT_ID(%d)", value);
|
||||
@@ -354,7 +355,7 @@ bool parse_report_descriptor(uint8_t *rep, uint16_t rep_size, hid_report_t *conf
|
||||
|
||||
case 9:
|
||||
hidp_extreme_debugf("REPORT_COUNT(%d)", value);
|
||||
report_count = value;
|
||||
report_count = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -15,27 +15,28 @@ typedef struct {
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
uint16_t offset;
|
||||
uint8_t size;
|
||||
struct {
|
||||
uint16_t min;
|
||||
uint16_t max;
|
||||
} logical;
|
||||
uint16_t offset;
|
||||
uint8_t size;
|
||||
struct {
|
||||
uint16_t min;
|
||||
uint16_t max;
|
||||
} logical;
|
||||
} axis[2]; // x and y axis
|
||||
|
||||
struct {
|
||||
uint8_t byte_offset;
|
||||
uint8_t bitmask;
|
||||
uint8_t byte_offset;
|
||||
uint8_t bitmask;
|
||||
} button[12]; // 12 buttons max
|
||||
|
||||
struct {
|
||||
uint16_t offset;
|
||||
uint8_t size;
|
||||
uint16_t offset;
|
||||
uint8_t size;
|
||||
} hat; // 1 hat (joystick only)
|
||||
|
||||
// for downstream mapping
|
||||
uint16_t vid;
|
||||
uint16_t pid;
|
||||
uint8_t button_count;
|
||||
|
||||
} joystick_mouse;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user