namespace portdefs {
portctrl::controller port_tmp_0 = {"gamepad", "gamepad", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
}};
portctrl::controller_set port_tmp_1 = {
	"gamepad", "gamepad", "gamepad",{port_tmp_0, },{1, 2, }
};
}
struct _gamepad : public portctrl::type
{
	_gamepad() : type("gamepad", "gamepad", 2)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 3:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				case 4:
					if(x) buffer[0]|=16; else buffer[0]&=239;
					break;
				case 5:
					if(x) buffer[0]|=32; else buffer[0]&=223;
					break;
				case 6:
					if(x) buffer[0]|=64; else buffer[0]&=191;
					break;
				case 7:
					if(x) buffer[0]|=128; else buffer[0]&=127;
					break;
				case 8:
					if(x) buffer[1]|=1; else buffer[1]&=254;
					break;
				case 9:
					if(x) buffer[1]|=2; else buffer[1]&=253;
					break;
				case 10:
					if(x) buffer[1]|=4; else buffer[1]&=251;
					break;
				case 11:
					if(x) buffer[1]|=8; else buffer[1]&=247;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (buffer[0]&4) ? 1 : 0;
				case 3:
					return (buffer[0]&8) ? 1 : 0;
				case 4:
					return (buffer[0]&16) ? 1 : 0;
				case 5:
					return (buffer[0]&32) ? 1 : 0;
				case 6:
					return (buffer[0]&64) ? 1 : 0;
				case 7:
					return (buffer[0]&128) ? 1 : 0;
				case 8:
					return (buffer[1]&1) ? 1 : 0;
				case 9:
					return (buffer[1]&2) ? 1 : 0;
				case 10:
					return (buffer[1]&4) ? 1 : 0;
				case 11:
					return (buffer[1]&8) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[0] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[0] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[0] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[0] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[1] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[1] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[1] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[1] & 8) ? (char)82 : '.';
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 2);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=8;
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_1;
	}
} gamepad;
namespace portdefs {
portctrl::controller port_tmp_2 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller_set port_tmp_3 = {
	"gamepad16", "gamepad (16 buttons)", "gamepad16",{port_tmp_2, },{1, 2, }
};
}
struct _gamepad16 : public portctrl::type
{
	_gamepad16() : type("gamepad16", "gamepad (16 buttons)", 2)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 3:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				case 4:
					if(x) buffer[0]|=16; else buffer[0]&=239;
					break;
				case 5:
					if(x) buffer[0]|=32; else buffer[0]&=223;
					break;
				case 6:
					if(x) buffer[0]|=64; else buffer[0]&=191;
					break;
				case 7:
					if(x) buffer[0]|=128; else buffer[0]&=127;
					break;
				case 8:
					if(x) buffer[1]|=1; else buffer[1]&=254;
					break;
				case 9:
					if(x) buffer[1]|=2; else buffer[1]&=253;
					break;
				case 10:
					if(x) buffer[1]|=4; else buffer[1]&=251;
					break;
				case 11:
					if(x) buffer[1]|=8; else buffer[1]&=247;
					break;
				case 12:
					if(x) buffer[1]|=16; else buffer[1]&=239;
					break;
				case 13:
					if(x) buffer[1]|=32; else buffer[1]&=223;
					break;
				case 14:
					if(x) buffer[1]|=64; else buffer[1]&=191;
					break;
				case 15:
					if(x) buffer[1]|=128; else buffer[1]&=127;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (buffer[0]&4) ? 1 : 0;
				case 3:
					return (buffer[0]&8) ? 1 : 0;
				case 4:
					return (buffer[0]&16) ? 1 : 0;
				case 5:
					return (buffer[0]&32) ? 1 : 0;
				case 6:
					return (buffer[0]&64) ? 1 : 0;
				case 7:
					return (buffer[0]&128) ? 1 : 0;
				case 8:
					return (buffer[1]&1) ? 1 : 0;
				case 9:
					return (buffer[1]&2) ? 1 : 0;
				case 10:
					return (buffer[1]&4) ? 1 : 0;
				case 11:
					return (buffer[1]&8) ? 1 : 0;
				case 12:
					return (buffer[1]&16) ? 1 : 0;
				case 13:
					return (buffer[1]&32) ? 1 : 0;
				case 14:
					return (buffer[1]&64) ? 1 : 0;
				case 15:
					return (buffer[1]&128) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[0] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[0] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[0] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[0] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[1] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[1] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[1] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[1] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[1] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[1] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[1] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[1] & 128) ? (char)51 : '.';
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 2);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_3;
	}
} gamepad16;
namespace portdefs {
portctrl::controller port_tmp_4 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller port_tmp_5 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller_set port_tmp_6 = {
	"ygamepad16", "Y-cabled gamepad (16 buttons)", "ygamepad16",{port_tmp_4, port_tmp_5, },{1, 2, }
};
}
struct _ygamepad16 : public portctrl::type
{
	_ygamepad16() : type("ygamepad16", "Y-cabled gamepad (16 buttons)", 4)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 3:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				case 4:
					if(x) buffer[0]|=16; else buffer[0]&=239;
					break;
				case 5:
					if(x) buffer[0]|=32; else buffer[0]&=223;
					break;
				case 6:
					if(x) buffer[0]|=64; else buffer[0]&=191;
					break;
				case 7:
					if(x) buffer[0]|=128; else buffer[0]&=127;
					break;
				case 8:
					if(x) buffer[1]|=1; else buffer[1]&=254;
					break;
				case 9:
					if(x) buffer[1]|=2; else buffer[1]&=253;
					break;
				case 10:
					if(x) buffer[1]|=4; else buffer[1]&=251;
					break;
				case 11:
					if(x) buffer[1]|=8; else buffer[1]&=247;
					break;
				case 12:
					if(x) buffer[1]|=16; else buffer[1]&=239;
					break;
				case 13:
					if(x) buffer[1]|=32; else buffer[1]&=223;
					break;
				case 14:
					if(x) buffer[1]|=64; else buffer[1]&=191;
					break;
				case 15:
					if(x) buffer[1]|=128; else buffer[1]&=127;
					break;
				}
				break;
			case 1:
				switch(ctrl) {
				case 0:
					if(x) buffer[2]|=1; else buffer[2]&=254;
					break;
				case 1:
					if(x) buffer[2]|=2; else buffer[2]&=253;
					break;
				case 2:
					if(x) buffer[2]|=4; else buffer[2]&=251;
					break;
				case 3:
					if(x) buffer[2]|=8; else buffer[2]&=247;
					break;
				case 4:
					if(x) buffer[2]|=16; else buffer[2]&=239;
					break;
				case 5:
					if(x) buffer[2]|=32; else buffer[2]&=223;
					break;
				case 6:
					if(x) buffer[2]|=64; else buffer[2]&=191;
					break;
				case 7:
					if(x) buffer[2]|=128; else buffer[2]&=127;
					break;
				case 8:
					if(x) buffer[3]|=1; else buffer[3]&=254;
					break;
				case 9:
					if(x) buffer[3]|=2; else buffer[3]&=253;
					break;
				case 10:
					if(x) buffer[3]|=4; else buffer[3]&=251;
					break;
				case 11:
					if(x) buffer[3]|=8; else buffer[3]&=247;
					break;
				case 12:
					if(x) buffer[3]|=16; else buffer[3]&=239;
					break;
				case 13:
					if(x) buffer[3]|=32; else buffer[3]&=223;
					break;
				case 14:
					if(x) buffer[3]|=64; else buffer[3]&=191;
					break;
				case 15:
					if(x) buffer[3]|=128; else buffer[3]&=127;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (buffer[0]&4) ? 1 : 0;
				case 3:
					return (buffer[0]&8) ? 1 : 0;
				case 4:
					return (buffer[0]&16) ? 1 : 0;
				case 5:
					return (buffer[0]&32) ? 1 : 0;
				case 6:
					return (buffer[0]&64) ? 1 : 0;
				case 7:
					return (buffer[0]&128) ? 1 : 0;
				case 8:
					return (buffer[1]&1) ? 1 : 0;
				case 9:
					return (buffer[1]&2) ? 1 : 0;
				case 10:
					return (buffer[1]&4) ? 1 : 0;
				case 11:
					return (buffer[1]&8) ? 1 : 0;
				case 12:
					return (buffer[1]&16) ? 1 : 0;
				case 13:
					return (buffer[1]&32) ? 1 : 0;
				case 14:
					return (buffer[1]&64) ? 1 : 0;
				case 15:
					return (buffer[1]&128) ? 1 : 0;
				}
				return 0;
			case 1:
				switch(ctrl) {
				case 0:
					return (buffer[2]&1) ? 1 : 0;
				case 1:
					return (buffer[2]&2) ? 1 : 0;
				case 2:
					return (buffer[2]&4) ? 1 : 0;
				case 3:
					return (buffer[2]&8) ? 1 : 0;
				case 4:
					return (buffer[2]&16) ? 1 : 0;
				case 5:
					return (buffer[2]&32) ? 1 : 0;
				case 6:
					return (buffer[2]&64) ? 1 : 0;
				case 7:
					return (buffer[2]&128) ? 1 : 0;
				case 8:
					return (buffer[3]&1) ? 1 : 0;
				case 9:
					return (buffer[3]&2) ? 1 : 0;
				case 10:
					return (buffer[3]&4) ? 1 : 0;
				case 11:
					return (buffer[3]&8) ? 1 : 0;
				case 12:
					return (buffer[3]&16) ? 1 : 0;
				case 13:
					return (buffer[3]&32) ? 1 : 0;
				case 14:
					return (buffer[3]&64) ? 1 : 0;
				case 15:
					return (buffer[3]&128) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[0] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[0] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[0] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[0] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[1] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[1] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[1] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[1] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[1] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[1] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[1] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[1] & 128) ? (char)51 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[2] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[2] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[2] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[2] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[2] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[2] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[2] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[2] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[3] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[3] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[3] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[3] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[3] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[3] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[3] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[3] & 128) ? (char)51 : '.';
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 4);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_6;
	}
} ygamepad16;
namespace portdefs {
portctrl::controller port_tmp_7 = {"justifier", "justifier", {
	{portctrl::button::TYPE_LIGHTGUN,0, "xaxis", 0, -16, 271, 0, "", 0},
	{portctrl::button::TYPE_LIGHTGUN,0, "yaxis", 0, -16, 255, 0, "", 0},
	{portctrl::button::TYPE_BUTTON,84, "trigger", 0, 0, 0, 0, "T", 84},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
}};
portctrl::controller_set port_tmp_8 = {
	"justifier", "Justifier", "justifier",{port_tmp_7, },{2, }
};
}
struct _justifier : public portctrl::type
{
	_justifier() : type("justifier", "Justifier", 5)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					buffer[1]=(unsigned short)x;
					buffer[2]=((unsigned short)x >> 8);
					break;
				case 1:
					buffer[3]=(unsigned short)x;
					buffer[4]=((unsigned short)x >> 8);
					break;
				case 2:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 3:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
				case 1:
					return (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
				case 2:
					return (buffer[0]&1) ? 1 : 0;
				case 3:
					return (buffer[0]&2) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)84 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)83 : '.';
			tmp = (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 5);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[1] = (unsigned short)tmp;
			buffer[2] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[3] = (unsigned short)tmp;
			buffer[4] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_8;
	}
} justifier;
namespace portdefs {
portctrl::controller port_tmp_9 = {"justifier", "justifier", {
	{portctrl::button::TYPE_LIGHTGUN,0, "xaxis", 0, -16, 271, 0, "", 0},
	{portctrl::button::TYPE_LIGHTGUN,0, "yaxis", 0, -16, 255, 0, "", 0},
	{portctrl::button::TYPE_BUTTON,84, "trigger", 0, 0, 0, 0, "T", 84},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
}};
portctrl::controller port_tmp_10 = {"justifier", "justifier", {
	{portctrl::button::TYPE_LIGHTGUN,0, "xaxis", 0, -16, 271, 0, "", 0},
	{portctrl::button::TYPE_LIGHTGUN,0, "yaxis", 0, -16, 255, 0, "", 0},
	{portctrl::button::TYPE_BUTTON,84, "trigger", 0, 0, 0, 0, "T", 84},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
}};
portctrl::controller_set port_tmp_11 = {
	"justifiers", "2 Justifiers", "justifiers",{port_tmp_9, port_tmp_10, },{2, }
};
}
struct _justifiers : public portctrl::type
{
	_justifiers() : type("justifiers", "2 Justifiers", 9)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					buffer[1]=(unsigned short)x;
					buffer[2]=((unsigned short)x >> 8);
					break;
				case 1:
					buffer[3]=(unsigned short)x;
					buffer[4]=((unsigned short)x >> 8);
					break;
				case 2:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 3:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				}
				break;
			case 1:
				switch(ctrl) {
				case 0:
					buffer[5]=(unsigned short)x;
					buffer[6]=((unsigned short)x >> 8);
					break;
				case 1:
					buffer[7]=(unsigned short)x;
					buffer[8]=((unsigned short)x >> 8);
					break;
				case 2:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 3:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
				case 1:
					return (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
				case 2:
					return (buffer[0]&1) ? 1 : 0;
				case 3:
					return (buffer[0]&2) ? 1 : 0;
				}
				return 0;
			case 1:
				switch(ctrl) {
				case 0:
					return (short)((unsigned short)buffer[5] + ((unsigned short)buffer[6] << 8));
				case 1:
					return (short)((unsigned short)buffer[7] + ((unsigned short)buffer[8] << 8));
				case 2:
					return (buffer[0]&4) ? 1 : 0;
				case 3:
					return (buffer[0]&8) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)84 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)83 : '.';
			tmp = (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)84 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)83 : '.';
			tmp = (short)((unsigned short)buffer[5] + ((unsigned short)buffer[6] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[7] + ((unsigned short)buffer[8] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 9);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[1] = (unsigned short)tmp;
			buffer[2] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[3] = (unsigned short)tmp;
			buffer[4] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[5] = (unsigned short)tmp;
			buffer[6] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[7] = (unsigned short)tmp;
			buffer[8] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_11;
	}
} justifiers;
namespace portdefs {
portctrl::controller port_tmp_12 = {"mouse", "mouse", {
	{portctrl::button::TYPE_RAXIS,0, "xaxis", 0, -255, 255, 1, "", 0},
	{portctrl::button::TYPE_RAXIS,0, "yaxis", 0, -255, 255, 1, "", 0},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
}};
portctrl::controller_set port_tmp_13 = {
	"mouse", "Mouse", "mouse",{port_tmp_12, },{1, 2, }
};
}
struct _mouse : public portctrl::type
{
	_mouse() : type("mouse", "Mouse", 5)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					buffer[1]=(unsigned short)x;
					buffer[2]=((unsigned short)x >> 8);
					break;
				case 1:
					buffer[3]=(unsigned short)x;
					buffer[4]=((unsigned short)x >> 8);
					break;
				case 2:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 3:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
				case 1:
					return (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
				case 2:
					return (buffer[0]&1) ? 1 : 0;
				case 3:
					return (buffer[0]&2) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)82 : '.';
			tmp = (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 5);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[1] = (unsigned short)tmp;
			buffer[2] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[3] = (unsigned short)tmp;
			buffer[4] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_13;
	}
} mouse;
namespace portdefs {
portctrl::controller port_tmp_14 = {"gamepad", "gamepad", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
}};
portctrl::controller port_tmp_15 = {"gamepad", "gamepad", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
}};
portctrl::controller port_tmp_16 = {"gamepad", "gamepad", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
}};
portctrl::controller port_tmp_17 = {"gamepad", "gamepad", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
}};
portctrl::controller_set port_tmp_18 = {
	"multitap", "Multitap", "multitap",{port_tmp_14, port_tmp_15, port_tmp_16, port_tmp_17, },{1, 2, }
};
}
struct _multitap : public portctrl::type
{
	_multitap() : type("multitap", "Multitap", 6)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 3:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				case 4:
					if(x) buffer[0]|=16; else buffer[0]&=239;
					break;
				case 5:
					if(x) buffer[0]|=32; else buffer[0]&=223;
					break;
				case 6:
					if(x) buffer[0]|=64; else buffer[0]&=191;
					break;
				case 7:
					if(x) buffer[0]|=128; else buffer[0]&=127;
					break;
				case 8:
					if(x) buffer[1]|=1; else buffer[1]&=254;
					break;
				case 9:
					if(x) buffer[1]|=2; else buffer[1]&=253;
					break;
				case 10:
					if(x) buffer[1]|=4; else buffer[1]&=251;
					break;
				case 11:
					if(x) buffer[1]|=8; else buffer[1]&=247;
					break;
				}
				break;
			case 1:
				switch(ctrl) {
				case 0:
					if(x) buffer[1]|=16; else buffer[1]&=239;
					break;
				case 1:
					if(x) buffer[1]|=32; else buffer[1]&=223;
					break;
				case 2:
					if(x) buffer[1]|=64; else buffer[1]&=191;
					break;
				case 3:
					if(x) buffer[1]|=128; else buffer[1]&=127;
					break;
				case 4:
					if(x) buffer[2]|=1; else buffer[2]&=254;
					break;
				case 5:
					if(x) buffer[2]|=2; else buffer[2]&=253;
					break;
				case 6:
					if(x) buffer[2]|=4; else buffer[2]&=251;
					break;
				case 7:
					if(x) buffer[2]|=8; else buffer[2]&=247;
					break;
				case 8:
					if(x) buffer[2]|=16; else buffer[2]&=239;
					break;
				case 9:
					if(x) buffer[2]|=32; else buffer[2]&=223;
					break;
				case 10:
					if(x) buffer[2]|=64; else buffer[2]&=191;
					break;
				case 11:
					if(x) buffer[2]|=128; else buffer[2]&=127;
					break;
				}
				break;
			case 2:
				switch(ctrl) {
				case 0:
					if(x) buffer[3]|=1; else buffer[3]&=254;
					break;
				case 1:
					if(x) buffer[3]|=2; else buffer[3]&=253;
					break;
				case 2:
					if(x) buffer[3]|=4; else buffer[3]&=251;
					break;
				case 3:
					if(x) buffer[3]|=8; else buffer[3]&=247;
					break;
				case 4:
					if(x) buffer[3]|=16; else buffer[3]&=239;
					break;
				case 5:
					if(x) buffer[3]|=32; else buffer[3]&=223;
					break;
				case 6:
					if(x) buffer[3]|=64; else buffer[3]&=191;
					break;
				case 7:
					if(x) buffer[3]|=128; else buffer[3]&=127;
					break;
				case 8:
					if(x) buffer[4]|=1; else buffer[4]&=254;
					break;
				case 9:
					if(x) buffer[4]|=2; else buffer[4]&=253;
					break;
				case 10:
					if(x) buffer[4]|=4; else buffer[4]&=251;
					break;
				case 11:
					if(x) buffer[4]|=8; else buffer[4]&=247;
					break;
				}
				break;
			case 3:
				switch(ctrl) {
				case 0:
					if(x) buffer[4]|=16; else buffer[4]&=239;
					break;
				case 1:
					if(x) buffer[4]|=32; else buffer[4]&=223;
					break;
				case 2:
					if(x) buffer[4]|=64; else buffer[4]&=191;
					break;
				case 3:
					if(x) buffer[4]|=128; else buffer[4]&=127;
					break;
				case 4:
					if(x) buffer[5]|=1; else buffer[5]&=254;
					break;
				case 5:
					if(x) buffer[5]|=2; else buffer[5]&=253;
					break;
				case 6:
					if(x) buffer[5]|=4; else buffer[5]&=251;
					break;
				case 7:
					if(x) buffer[5]|=8; else buffer[5]&=247;
					break;
				case 8:
					if(x) buffer[5]|=16; else buffer[5]&=239;
					break;
				case 9:
					if(x) buffer[5]|=32; else buffer[5]&=223;
					break;
				case 10:
					if(x) buffer[5]|=64; else buffer[5]&=191;
					break;
				case 11:
					if(x) buffer[5]|=128; else buffer[5]&=127;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (buffer[0]&4) ? 1 : 0;
				case 3:
					return (buffer[0]&8) ? 1 : 0;
				case 4:
					return (buffer[0]&16) ? 1 : 0;
				case 5:
					return (buffer[0]&32) ? 1 : 0;
				case 6:
					return (buffer[0]&64) ? 1 : 0;
				case 7:
					return (buffer[0]&128) ? 1 : 0;
				case 8:
					return (buffer[1]&1) ? 1 : 0;
				case 9:
					return (buffer[1]&2) ? 1 : 0;
				case 10:
					return (buffer[1]&4) ? 1 : 0;
				case 11:
					return (buffer[1]&8) ? 1 : 0;
				}
				return 0;
			case 1:
				switch(ctrl) {
				case 0:
					return (buffer[1]&16) ? 1 : 0;
				case 1:
					return (buffer[1]&32) ? 1 : 0;
				case 2:
					return (buffer[1]&64) ? 1 : 0;
				case 3:
					return (buffer[1]&128) ? 1 : 0;
				case 4:
					return (buffer[2]&1) ? 1 : 0;
				case 5:
					return (buffer[2]&2) ? 1 : 0;
				case 6:
					return (buffer[2]&4) ? 1 : 0;
				case 7:
					return (buffer[2]&8) ? 1 : 0;
				case 8:
					return (buffer[2]&16) ? 1 : 0;
				case 9:
					return (buffer[2]&32) ? 1 : 0;
				case 10:
					return (buffer[2]&64) ? 1 : 0;
				case 11:
					return (buffer[2]&128) ? 1 : 0;
				}
				return 0;
			case 2:
				switch(ctrl) {
				case 0:
					return (buffer[3]&1) ? 1 : 0;
				case 1:
					return (buffer[3]&2) ? 1 : 0;
				case 2:
					return (buffer[3]&4) ? 1 : 0;
				case 3:
					return (buffer[3]&8) ? 1 : 0;
				case 4:
					return (buffer[3]&16) ? 1 : 0;
				case 5:
					return (buffer[3]&32) ? 1 : 0;
				case 6:
					return (buffer[3]&64) ? 1 : 0;
				case 7:
					return (buffer[3]&128) ? 1 : 0;
				case 8:
					return (buffer[4]&1) ? 1 : 0;
				case 9:
					return (buffer[4]&2) ? 1 : 0;
				case 10:
					return (buffer[4]&4) ? 1 : 0;
				case 11:
					return (buffer[4]&8) ? 1 : 0;
				}
				return 0;
			case 3:
				switch(ctrl) {
				case 0:
					return (buffer[4]&16) ? 1 : 0;
				case 1:
					return (buffer[4]&32) ? 1 : 0;
				case 2:
					return (buffer[4]&64) ? 1 : 0;
				case 3:
					return (buffer[4]&128) ? 1 : 0;
				case 4:
					return (buffer[5]&1) ? 1 : 0;
				case 5:
					return (buffer[5]&2) ? 1 : 0;
				case 6:
					return (buffer[5]&4) ? 1 : 0;
				case 7:
					return (buffer[5]&8) ? 1 : 0;
				case 8:
					return (buffer[5]&16) ? 1 : 0;
				case 9:
					return (buffer[5]&32) ? 1 : 0;
				case 10:
					return (buffer[5]&64) ? 1 : 0;
				case 11:
					return (buffer[5]&128) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[0] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[0] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[0] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[0] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[1] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[1] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[1] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[1] & 8) ? (char)82 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[1] & 16) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[1] & 32) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[1] & 64) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[1] & 128) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[2] & 1) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[2] & 2) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[2] & 4) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[2] & 8) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[2] & 16) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[2] & 32) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[2] & 64) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[2] & 128) ? (char)82 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[3] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[3] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[3] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[3] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[3] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[3] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[3] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[3] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[4] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[4] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[4] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[4] & 8) ? (char)82 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[4] & 16) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[4] & 32) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[4] & 64) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[4] & 128) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[5] & 1) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[5] & 2) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[5] & 4) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[5] & 8) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[5] & 16) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[5] & 32) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[5] & 64) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[5] & 128) ? (char)82 : '.';
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 6);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=8;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=8;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_18;
	}
} multitap;
namespace portdefs {
portctrl::controller port_tmp_19 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller port_tmp_20 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller port_tmp_21 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller port_tmp_22 = {"gamepad", "gamepad16", {
	{portctrl::button::TYPE_BUTTON,66, "B", 0, 0, 0, 0, "B", 66},
	{portctrl::button::TYPE_BUTTON,89, "Y", 0, 0, 0, 0, "Y", 89},
	{portctrl::button::TYPE_BUTTON,115, "select", 0, 0, 0, 0, "s", 115},
	{portctrl::button::TYPE_BUTTON,83, "start", 0, 0, 0, 0, "S", 83},
	{portctrl::button::TYPE_BUTTON,8593, "up", 0, 0, 0, 0, "^", 117},
	{portctrl::button::TYPE_BUTTON,8595, "down", 0, 0, 0, 0, "v", 100},
	{portctrl::button::TYPE_BUTTON,8592, "left", 0, 0, 0, 0, "<", 108},
	{portctrl::button::TYPE_BUTTON,8594, "right", 0, 0, 0, 0, ">", 114},
	{portctrl::button::TYPE_BUTTON,65, "A", 0, 0, 0, 0, "A", 65},
	{portctrl::button::TYPE_BUTTON,88, "X", 0, 0, 0, 0, "X", 88},
	{portctrl::button::TYPE_BUTTON,76, "L", 0, 0, 0, 0, "L", 76},
	{portctrl::button::TYPE_BUTTON,82, "R", 0, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_BUTTON,48, "ext0", 0, 0, 0, 0, "E0", 48},
	{portctrl::button::TYPE_BUTTON,49, "ext1", 0, 0, 0, 0, "E1", 49},
	{portctrl::button::TYPE_BUTTON,50, "ext2", 0, 0, 0, 0, "E2", 50},
	{portctrl::button::TYPE_BUTTON,51, "ext3", 0, 0, 0, 0, "E3", 51},
}};
portctrl::controller_set port_tmp_23 = {
	"multitap16", "Multitap (16 buttons)", "multitap16",{port_tmp_19, port_tmp_20, port_tmp_21, port_tmp_22, },{1, 2, }
};
}
struct _multitap16 : public portctrl::type
{
	_multitap16() : type("multitap16", "Multitap (16 buttons)", 8)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 3:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				case 4:
					if(x) buffer[0]|=16; else buffer[0]&=239;
					break;
				case 5:
					if(x) buffer[0]|=32; else buffer[0]&=223;
					break;
				case 6:
					if(x) buffer[0]|=64; else buffer[0]&=191;
					break;
				case 7:
					if(x) buffer[0]|=128; else buffer[0]&=127;
					break;
				case 8:
					if(x) buffer[1]|=1; else buffer[1]&=254;
					break;
				case 9:
					if(x) buffer[1]|=2; else buffer[1]&=253;
					break;
				case 10:
					if(x) buffer[1]|=4; else buffer[1]&=251;
					break;
				case 11:
					if(x) buffer[1]|=8; else buffer[1]&=247;
					break;
				case 12:
					if(x) buffer[1]|=16; else buffer[1]&=239;
					break;
				case 13:
					if(x) buffer[1]|=32; else buffer[1]&=223;
					break;
				case 14:
					if(x) buffer[1]|=64; else buffer[1]&=191;
					break;
				case 15:
					if(x) buffer[1]|=128; else buffer[1]&=127;
					break;
				}
				break;
			case 1:
				switch(ctrl) {
				case 0:
					if(x) buffer[2]|=1; else buffer[2]&=254;
					break;
				case 1:
					if(x) buffer[2]|=2; else buffer[2]&=253;
					break;
				case 2:
					if(x) buffer[2]|=4; else buffer[2]&=251;
					break;
				case 3:
					if(x) buffer[2]|=8; else buffer[2]&=247;
					break;
				case 4:
					if(x) buffer[2]|=16; else buffer[2]&=239;
					break;
				case 5:
					if(x) buffer[2]|=32; else buffer[2]&=223;
					break;
				case 6:
					if(x) buffer[2]|=64; else buffer[2]&=191;
					break;
				case 7:
					if(x) buffer[2]|=128; else buffer[2]&=127;
					break;
				case 8:
					if(x) buffer[3]|=1; else buffer[3]&=254;
					break;
				case 9:
					if(x) buffer[3]|=2; else buffer[3]&=253;
					break;
				case 10:
					if(x) buffer[3]|=4; else buffer[3]&=251;
					break;
				case 11:
					if(x) buffer[3]|=8; else buffer[3]&=247;
					break;
				case 12:
					if(x) buffer[3]|=16; else buffer[3]&=239;
					break;
				case 13:
					if(x) buffer[3]|=32; else buffer[3]&=223;
					break;
				case 14:
					if(x) buffer[3]|=64; else buffer[3]&=191;
					break;
				case 15:
					if(x) buffer[3]|=128; else buffer[3]&=127;
					break;
				}
				break;
			case 2:
				switch(ctrl) {
				case 0:
					if(x) buffer[4]|=1; else buffer[4]&=254;
					break;
				case 1:
					if(x) buffer[4]|=2; else buffer[4]&=253;
					break;
				case 2:
					if(x) buffer[4]|=4; else buffer[4]&=251;
					break;
				case 3:
					if(x) buffer[4]|=8; else buffer[4]&=247;
					break;
				case 4:
					if(x) buffer[4]|=16; else buffer[4]&=239;
					break;
				case 5:
					if(x) buffer[4]|=32; else buffer[4]&=223;
					break;
				case 6:
					if(x) buffer[4]|=64; else buffer[4]&=191;
					break;
				case 7:
					if(x) buffer[4]|=128; else buffer[4]&=127;
					break;
				case 8:
					if(x) buffer[5]|=1; else buffer[5]&=254;
					break;
				case 9:
					if(x) buffer[5]|=2; else buffer[5]&=253;
					break;
				case 10:
					if(x) buffer[5]|=4; else buffer[5]&=251;
					break;
				case 11:
					if(x) buffer[5]|=8; else buffer[5]&=247;
					break;
				case 12:
					if(x) buffer[5]|=16; else buffer[5]&=239;
					break;
				case 13:
					if(x) buffer[5]|=32; else buffer[5]&=223;
					break;
				case 14:
					if(x) buffer[5]|=64; else buffer[5]&=191;
					break;
				case 15:
					if(x) buffer[5]|=128; else buffer[5]&=127;
					break;
				}
				break;
			case 3:
				switch(ctrl) {
				case 0:
					if(x) buffer[6]|=1; else buffer[6]&=254;
					break;
				case 1:
					if(x) buffer[6]|=2; else buffer[6]&=253;
					break;
				case 2:
					if(x) buffer[6]|=4; else buffer[6]&=251;
					break;
				case 3:
					if(x) buffer[6]|=8; else buffer[6]&=247;
					break;
				case 4:
					if(x) buffer[6]|=16; else buffer[6]&=239;
					break;
				case 5:
					if(x) buffer[6]|=32; else buffer[6]&=223;
					break;
				case 6:
					if(x) buffer[6]|=64; else buffer[6]&=191;
					break;
				case 7:
					if(x) buffer[6]|=128; else buffer[6]&=127;
					break;
				case 8:
					if(x) buffer[7]|=1; else buffer[7]&=254;
					break;
				case 9:
					if(x) buffer[7]|=2; else buffer[7]&=253;
					break;
				case 10:
					if(x) buffer[7]|=4; else buffer[7]&=251;
					break;
				case 11:
					if(x) buffer[7]|=8; else buffer[7]&=247;
					break;
				case 12:
					if(x) buffer[7]|=16; else buffer[7]&=239;
					break;
				case 13:
					if(x) buffer[7]|=32; else buffer[7]&=223;
					break;
				case 14:
					if(x) buffer[7]|=64; else buffer[7]&=191;
					break;
				case 15:
					if(x) buffer[7]|=128; else buffer[7]&=127;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (buffer[0]&4) ? 1 : 0;
				case 3:
					return (buffer[0]&8) ? 1 : 0;
				case 4:
					return (buffer[0]&16) ? 1 : 0;
				case 5:
					return (buffer[0]&32) ? 1 : 0;
				case 6:
					return (buffer[0]&64) ? 1 : 0;
				case 7:
					return (buffer[0]&128) ? 1 : 0;
				case 8:
					return (buffer[1]&1) ? 1 : 0;
				case 9:
					return (buffer[1]&2) ? 1 : 0;
				case 10:
					return (buffer[1]&4) ? 1 : 0;
				case 11:
					return (buffer[1]&8) ? 1 : 0;
				case 12:
					return (buffer[1]&16) ? 1 : 0;
				case 13:
					return (buffer[1]&32) ? 1 : 0;
				case 14:
					return (buffer[1]&64) ? 1 : 0;
				case 15:
					return (buffer[1]&128) ? 1 : 0;
				}
				return 0;
			case 1:
				switch(ctrl) {
				case 0:
					return (buffer[2]&1) ? 1 : 0;
				case 1:
					return (buffer[2]&2) ? 1 : 0;
				case 2:
					return (buffer[2]&4) ? 1 : 0;
				case 3:
					return (buffer[2]&8) ? 1 : 0;
				case 4:
					return (buffer[2]&16) ? 1 : 0;
				case 5:
					return (buffer[2]&32) ? 1 : 0;
				case 6:
					return (buffer[2]&64) ? 1 : 0;
				case 7:
					return (buffer[2]&128) ? 1 : 0;
				case 8:
					return (buffer[3]&1) ? 1 : 0;
				case 9:
					return (buffer[3]&2) ? 1 : 0;
				case 10:
					return (buffer[3]&4) ? 1 : 0;
				case 11:
					return (buffer[3]&8) ? 1 : 0;
				case 12:
					return (buffer[3]&16) ? 1 : 0;
				case 13:
					return (buffer[3]&32) ? 1 : 0;
				case 14:
					return (buffer[3]&64) ? 1 : 0;
				case 15:
					return (buffer[3]&128) ? 1 : 0;
				}
				return 0;
			case 2:
				switch(ctrl) {
				case 0:
					return (buffer[4]&1) ? 1 : 0;
				case 1:
					return (buffer[4]&2) ? 1 : 0;
				case 2:
					return (buffer[4]&4) ? 1 : 0;
				case 3:
					return (buffer[4]&8) ? 1 : 0;
				case 4:
					return (buffer[4]&16) ? 1 : 0;
				case 5:
					return (buffer[4]&32) ? 1 : 0;
				case 6:
					return (buffer[4]&64) ? 1 : 0;
				case 7:
					return (buffer[4]&128) ? 1 : 0;
				case 8:
					return (buffer[5]&1) ? 1 : 0;
				case 9:
					return (buffer[5]&2) ? 1 : 0;
				case 10:
					return (buffer[5]&4) ? 1 : 0;
				case 11:
					return (buffer[5]&8) ? 1 : 0;
				case 12:
					return (buffer[5]&16) ? 1 : 0;
				case 13:
					return (buffer[5]&32) ? 1 : 0;
				case 14:
					return (buffer[5]&64) ? 1 : 0;
				case 15:
					return (buffer[5]&128) ? 1 : 0;
				}
				return 0;
			case 3:
				switch(ctrl) {
				case 0:
					return (buffer[6]&1) ? 1 : 0;
				case 1:
					return (buffer[6]&2) ? 1 : 0;
				case 2:
					return (buffer[6]&4) ? 1 : 0;
				case 3:
					return (buffer[6]&8) ? 1 : 0;
				case 4:
					return (buffer[6]&16) ? 1 : 0;
				case 5:
					return (buffer[6]&32) ? 1 : 0;
				case 6:
					return (buffer[6]&64) ? 1 : 0;
				case 7:
					return (buffer[6]&128) ? 1 : 0;
				case 8:
					return (buffer[7]&1) ? 1 : 0;
				case 9:
					return (buffer[7]&2) ? 1 : 0;
				case 10:
					return (buffer[7]&4) ? 1 : 0;
				case 11:
					return (buffer[7]&8) ? 1 : 0;
				case 12:
					return (buffer[7]&16) ? 1 : 0;
				case 13:
					return (buffer[7]&32) ? 1 : 0;
				case 14:
					return (buffer[7]&64) ? 1 : 0;
				case 15:
					return (buffer[7]&128) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[0] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[0] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[0] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[0] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[1] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[1] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[1] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[1] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[1] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[1] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[1] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[1] & 128) ? (char)51 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[2] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[2] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[2] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[2] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[2] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[2] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[2] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[2] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[3] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[3] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[3] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[3] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[3] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[3] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[3] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[3] & 128) ? (char)51 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[4] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[4] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[4] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[4] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[4] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[4] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[4] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[4] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[5] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[5] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[5] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[5] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[5] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[5] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[5] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[5] & 128) ? (char)51 : '.';
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[6] & 1) ? (char)66 : '.';
			textbuf[ptr++] = (buffer[6] & 2) ? (char)89 : '.';
			textbuf[ptr++] = (buffer[6] & 4) ? (char)115 : '.';
			textbuf[ptr++] = (buffer[6] & 8) ? (char)83 : '.';
			textbuf[ptr++] = (buffer[6] & 16) ? (char)117 : '.';
			textbuf[ptr++] = (buffer[6] & 32) ? (char)100 : '.';
			textbuf[ptr++] = (buffer[6] & 64) ? (char)108 : '.';
			textbuf[ptr++] = (buffer[6] & 128) ? (char)114 : '.';
			textbuf[ptr++] = (buffer[7] & 1) ? (char)65 : '.';
			textbuf[ptr++] = (buffer[7] & 2) ? (char)88 : '.';
			textbuf[ptr++] = (buffer[7] & 4) ? (char)76 : '.';
			textbuf[ptr++] = (buffer[7] & 8) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[7] & 16) ? (char)48 : '.';
			textbuf[ptr++] = (buffer[7] & 32) ? (char)49 : '.';
			textbuf[ptr++] = (buffer[7] & 64) ? (char)50 : '.';
			textbuf[ptr++] = (buffer[7] & 128) ? (char)51 : '.';
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 8);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[1]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[2]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[3]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[4]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[5]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, true);
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[6]|=128;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=8;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=16;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=32;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=64;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[7]|=128;
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_23;
	}
} multitap16;
namespace portdefs {
portctrl::controller_set port_tmp_24 = {
	"none", "None", "none",{},{1, 2, }
};
}
struct _none : public portctrl::type
{
	_none() : type("none", "None", 0)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			return 0;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 0);
			size_t ptr = 0;
			short tmp;
			return DESERIALIZE_SPECIAL_BLANK;
		};
		controller_info = &portdefs::port_tmp_24;
	}
} none;
namespace portdefs {
portctrl::controller port_tmp_25 = {"superscope", "superscope", {
	{portctrl::button::TYPE_LIGHTGUN,0, "xaxis", 0, -16, 271, 0, "", 0},
	{portctrl::button::TYPE_LIGHTGUN,0, "yaxis", 0, -16, 255, 0, "", 0},
	{portctrl::button::TYPE_BUTTON,84, "trigger", 0, 0, 0, 0, "T", 84},
	{portctrl::button::TYPE_BUTTON,67, "cursor", 0, 0, 0, 0, "C", 67},
	{portctrl::button::TYPE_BUTTON,85, "turbo", 0, 0, 0, 0, "U", 85},
	{portctrl::button::TYPE_BUTTON,80, "pause", 0, 0, 0, 0, "P", 80},
}};
portctrl::controller_set port_tmp_26 = {
	"superscope", "Super Scope", "superscope",{port_tmp_25, },{2, }
};
}
struct _superscope : public portctrl::type
{
	_superscope() : type("superscope", "Super Scope", 5)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					buffer[1]=(unsigned short)x;
					buffer[2]=((unsigned short)x >> 8);
					break;
				case 1:
					buffer[3]=(unsigned short)x;
					buffer[4]=((unsigned short)x >> 8);
					break;
				case 2:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 3:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 4:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				case 5:
					if(x) buffer[0]|=8; else buffer[0]&=247;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
				case 1:
					return (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
				case 2:
					return (buffer[0]&1) ? 1 : 0;
				case 3:
					return (buffer[0]&2) ? 1 : 0;
				case 4:
					return (buffer[0]&4) ? 1 : 0;
				case 5:
					return (buffer[0]&8) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = '|';
			textbuf[ptr++] = (buffer[0] & 1) ? (char)84 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)67 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)85 : '.';
			textbuf[ptr++] = (buffer[0] & 8) ? (char)80 : '.';
			tmp = (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 5);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=8;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[1] = (unsigned short)tmp;
			buffer[2] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[3] = (unsigned short)tmp;
			buffer[4] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_26;
	}
} superscope;
namespace portdefs {
portctrl::controller port_tmp_27 = {"(system)", "(system)", {
	{portctrl::button::TYPE_BUTTON,70, "framesync", 1, 0, 0, 0, "F", 70},
	{portctrl::button::TYPE_BUTTON,82, "reset", 1, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_AXIS,0, "rhigh", 1, -32768, 32767, 0, "", 0},
	{portctrl::button::TYPE_AXIS,0, "rlow", 1, -32768, 32767, 0, "", 0},
}};
portctrl::controller_set port_tmp_28 = {
	"system", "system", "psystem",{port_tmp_27, },{0, }
};
}
struct _psystem : public portctrl::type
{
	_psystem() : type("system", "system", 5)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					buffer[1]=(unsigned short)x;
					buffer[2]=((unsigned short)x >> 8);
					break;
				case 3:
					buffer[3]=(unsigned short)x;
					buffer[4]=((unsigned short)x >> 8);
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
				case 3:
					return (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = (buffer[0] & 1) ? (char)70 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)82 : '.';
			tmp = (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 5);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[1] = (unsigned short)tmp;
			buffer[2] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[3] = (unsigned short)tmp;
			buffer[4] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_28;
	}
} psystem;
namespace portdefs {
portctrl::controller port_tmp_29 = {"(system)", "(system)", {
	{portctrl::button::TYPE_BUTTON,70, "framesync", 1, 0, 0, 0, "F", 70},
	{portctrl::button::TYPE_BUTTON,82, "reset", 1, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_AXIS,0, "rhigh", 1, -32768, 32767, 0, "", 0},
	{portctrl::button::TYPE_AXIS,0, "rlow", 1, -32768, 32767, 0, "", 0},
	{portctrl::button::TYPE_BUTTON,72, "hard", 1, 0, 0, 0, "H", 72},
}};
portctrl::controller_set port_tmp_30 = {
	"system", "system", "psystem_hreset",{port_tmp_29, },{0, }
};
}
struct _psystem_hreset : public portctrl::type
{
	_psystem_hreset() : type("system", "system", 5)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					buffer[1]=(unsigned short)x;
					buffer[2]=((unsigned short)x >> 8);
					break;
				case 3:
					buffer[3]=(unsigned short)x;
					buffer[4]=((unsigned short)x >> 8);
					break;
				case 4:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
				case 3:
					return (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
				case 4:
					return (buffer[0]&4) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = (buffer[0] & 1) ? (char)70 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)72 : '.';
			tmp = (short)((unsigned short)buffer[1] + ((unsigned short)buffer[2] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			tmp = (short)((unsigned short)buffer[3] + ((unsigned short)buffer[4] << 8));
			ptr += sprintf(textbuf + ptr, " %i", tmp);
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 5);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[1] = (unsigned short)tmp;
			buffer[2] = ((unsigned short)tmp >> 8);
			tmp = portctrl::read_axis_value(textbuf, ptr);
			buffer[3] = (unsigned short)tmp;
			buffer[4] = ((unsigned short)tmp >> 8);
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_30;
	}
} psystem_hreset;
namespace portdefs {
portctrl::controller port_tmp_31 = {"(system)", "(system)", {
	{portctrl::button::TYPE_BUTTON,70, "framesync", 1, 0, 0, 0, "F", 70},
	{portctrl::button::TYPE_BUTTON,82, "reset", 1, 0, 0, 0, "R", 82},
	{portctrl::button::TYPE_NULL,0, "", 1, 0, 0, 0, "", 0},
	{portctrl::button::TYPE_NULL,0, "", 1, 0, 0, 0, "", 0},
	{portctrl::button::TYPE_BUTTON,72, "hard", 1, 0, 0, 0, "H", 72},
}};
portctrl::controller_set port_tmp_32 = {
	"system", "system", "psystem_compact",{port_tmp_31, },{0, }
};
}
struct _psystem_compact : public portctrl::type
{
	_psystem_compact() : type("system", "system", 1)
	{
		write = [](const portctrl::type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x) -> void {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					if(x) buffer[0]|=1; else buffer[0]&=254;
					break;
				case 1:
					if(x) buffer[0]|=2; else buffer[0]&=253;
					break;
				case 2:
					break;
				case 3:
					break;
				case 4:
					if(x) buffer[0]|=4; else buffer[0]&=251;
					break;
				}
				break;
			}
		};
		read = [](const portctrl::type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> short {
			switch(idx) {
			case 0:
				switch(ctrl) {
				case 0:
					return (buffer[0]&1) ? 1 : 0;
				case 1:
					return (buffer[0]&2) ? 1 : 0;
				case 2:
					return 0;
				case 3:
					return 0;
				case 4:
					return (buffer[0]&4) ? 1 : 0;
				}
			return 0;
			return 0;
			}
			return 0;
		};
		serialize = [](const portctrl::type* _this, const unsigned char* buffer, char* textbuf) -> size_t {
			size_t ptr = 0;
			short tmp;
			textbuf[ptr++] = (buffer[0] & 1) ? (char)70 : '.';
			textbuf[ptr++] = (buffer[0] & 2) ? (char)82 : '.';
			textbuf[ptr++] = (buffer[0] & 4) ? (char)72 : '.';
			return ptr;
		};
		deserialize = [](const portctrl::type* _this, unsigned char* buffer, const char* textbuf) -> size_t {
			memset(buffer, 0, 1);
			size_t ptr = 0;
			short tmp;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=1;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=2;
			if(portctrl::read_button_value(textbuf, ptr)) buffer[0]|=4;
			portctrl::skip_rest_of_field(textbuf, ptr, false);
			return ptr;
		};
		controller_info = &portdefs::port_tmp_32;
	}
} psystem_compact;
std::vector<portctrl::type*> _port_types{&gamepad, &gamepad16, &ygamepad16, &justifier, &justifiers, &mouse, &multitap, &multitap16, &none, &superscope, &psystem, &psystem_hreset, &psystem_compact, };
