Refactor porttype_info into library/ (as port_type)
This commit is contained in:
parent
81795bbaec
commit
5bae541b8b
11 changed files with 89 additions and 594 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include "library/controller-data.hpp"
|
||||
|
||||
/**
|
||||
* For now, reserve 23 bytes, for:
|
||||
|
@ -52,258 +53,11 @@
|
|||
* Size of controller page.
|
||||
*/
|
||||
#define CONTROLLER_PAGE_SIZE 65500
|
||||
/**
|
||||
* Special return value for deserialize() indicating no input was taken.
|
||||
*/
|
||||
#define DESERIALIZE_SPECIAL_BLANK 0xFFFFFFFFUL
|
||||
/**
|
||||
* Analog indices.
|
||||
*/
|
||||
#define MAX_ANALOG 3
|
||||
|
||||
/**
|
||||
* Is not field terminator.
|
||||
*
|
||||
* Parameter ch: The character.
|
||||
* Returns: True if character is not terminator, false if character is terminator.
|
||||
*/
|
||||
inline bool is_nonterminator(char ch) throw()
|
||||
{
|
||||
return (ch != '|' && ch != '\r' && ch != '\n' && ch != '\0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Read button value.
|
||||
*
|
||||
* Parameter buf: Buffer to read from.
|
||||
* Parameter idx: Index to buffer. Updated.
|
||||
* Returns: The read value.
|
||||
*/
|
||||
inline bool read_button_value(const char* buf, size_t& idx) throw()
|
||||
{
|
||||
char ch = buf[idx];
|
||||
if(is_nonterminator(ch))
|
||||
idx++;
|
||||
return (ch != '|' && ch != '\r' && ch != '\n' && ch != '\0' && ch != '.' && ch != ' ' && ch != '\t');
|
||||
}
|
||||
|
||||
/**
|
||||
* Read axis value.
|
||||
*
|
||||
* Parameter buf: Buffer to read from.
|
||||
* Parameter idx: Index to buffer. Updated.
|
||||
* Returns: The read value.
|
||||
*/
|
||||
short read_axis_value(const char* buf, size_t& idx) throw();
|
||||
|
||||
/**
|
||||
* Skip whitespace.
|
||||
*
|
||||
* Parameter buf: Buffer to read from.
|
||||
* Parameter idx: Index to buffer. Updated.
|
||||
*/
|
||||
inline void skip_field_whitespace(const char* buf, size_t& idx) throw()
|
||||
{
|
||||
while(buf[idx] == ' ' || buf[idx] == '\t')
|
||||
idx++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip rest of the field.
|
||||
*
|
||||
* Parameter buf: Buffer to read from.
|
||||
* Parameter idx: Index to buffer. Updated.
|
||||
* Parameter include_pipe: If true, also skip the '|'.
|
||||
*/
|
||||
inline void skip_rest_of_field(const char* buf, size_t& idx, bool include_pipe) throw()
|
||||
{
|
||||
while(is_nonterminator(buf[idx]))
|
||||
idx++;
|
||||
if(include_pipe && buf[idx] == '|')
|
||||
idx++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize short.
|
||||
*/
|
||||
inline void serialize_short(unsigned char* buf, short val)
|
||||
{
|
||||
buf[0] = static_cast<unsigned short>(val) >> 8;
|
||||
buf[1] = static_cast<unsigned short>(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize short.
|
||||
*/
|
||||
inline short unserialize_short(const unsigned char* buf)
|
||||
{
|
||||
return static_cast<short>((static_cast<unsigned short>(buf[0]) << 8) | static_cast<unsigned short>(buf[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about port type.
|
||||
*/
|
||||
struct porttype_info
|
||||
{
|
||||
/**
|
||||
* Look up information about port type.
|
||||
*
|
||||
* Parameter p: The port type string.
|
||||
* Returns: Infor about port type.
|
||||
* Throws std::runtime_error: Invalid port type.
|
||||
*/
|
||||
static porttype_info& lookup(const std::string& p) throw(std::runtime_error);
|
||||
/**
|
||||
* Get set of all available port types.
|
||||
*/
|
||||
static std::list<porttype_info*> get_all();
|
||||
/**
|
||||
* Get some default port type.
|
||||
*/
|
||||
static porttype_info& default_type();
|
||||
/**
|
||||
* Get port default type.
|
||||
*/
|
||||
static porttype_info& port_default(unsigned port);
|
||||
/**
|
||||
* Register port type.
|
||||
*
|
||||
* Parameter pname: The name of port type.
|
||||
* Parameter hname: Human-readable name of the port type.
|
||||
* Parameter psize: The size of storage for this type.
|
||||
* Throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
porttype_info(const std::string& pname, const std::string& hname, unsigned _pt_id, size_t psize)
|
||||
throw(std::bad_alloc);
|
||||
/**
|
||||
* Unregister port type.
|
||||
*/
|
||||
~porttype_info() throw();
|
||||
/**
|
||||
* Writes controller data into compressed representation.
|
||||
*
|
||||
* Parameter buffer: The buffer storing compressed representation of controller state.
|
||||
* Parameter idx: Index of controller.
|
||||
* Parameter ctrl: The control to manipulate.
|
||||
* Parameter x: New value for control. Only zero/nonzero matters for buttons.
|
||||
*/
|
||||
void (*write)(unsigned char* buffer, unsigned idx, unsigned ctrl, short x);
|
||||
/**
|
||||
* Read controller data from compressed representation.
|
||||
*
|
||||
* Parameter buffer: The buffer storing compressed representation of controller state.
|
||||
* Parameter idx: Index of controller.
|
||||
* Parameter ctrl: The control to query.
|
||||
* Returns: The value of control. Buttons return 0 or 1.
|
||||
*/
|
||||
short (*read)(const unsigned char* buffer, unsigned idx, unsigned ctrl);
|
||||
/**
|
||||
* Format compressed controller data into input display.
|
||||
*
|
||||
* Parameter buffer: The buffer storing compressed representation of controller state.
|
||||
* Parameter idx: Index of controller.
|
||||
* Parameter buf: The buffer to write NUL-terminated display string to. Assumed to be MAX_DISPLAY_LENGTH bytes in size.
|
||||
*/
|
||||
void (*display)(const unsigned char* buffer, unsigned idx, char* buf);
|
||||
/**
|
||||
* Take compressed controller data and serialize it into textual representation.
|
||||
*
|
||||
* - The initial '|' is also written.
|
||||
*
|
||||
* Parameter buffer: The buffer storing compressed representation of controller state.
|
||||
* Parameter textbuf: The text buffer to write to.
|
||||
* Returns: Number of bytes written.
|
||||
*/
|
||||
size_t (*serialize)(const unsigned char* buffer, char* textbuf);
|
||||
/**
|
||||
* Unserialize textual representation into compressed controller state.
|
||||
*
|
||||
* - Only stops reading on '|', NUL, CR or LF in the final read field. That byte is not read.
|
||||
*
|
||||
* Parameter buffer: The buffer storing compressed representation of controller state.
|
||||
* Parameter textbuf: The text buffer to read.
|
||||
* Returns: Number of bytes read.
|
||||
* Throws std::runtime_error: Bad serialization.
|
||||
*/
|
||||
size_t (*deserialize)(unsigned char* buffer, const char* textbuf);
|
||||
/**
|
||||
* Get device flags for given index.
|
||||
*
|
||||
* Parameter idx: The index of controller.
|
||||
* Returns: The device flags.
|
||||
* Bit 0: Present.
|
||||
* Bit 1: Has absolute analog axes 0 and 1.
|
||||
* Bit 2: Has relative analog axes 0 and 1.
|
||||
*/
|
||||
unsigned (*deviceflags)(unsigned idx);
|
||||
/**
|
||||
* Is the device legal for port?
|
||||
*
|
||||
* Parameter port: Port to query.
|
||||
* Returns: Nonzero if legal, zero if illegal.
|
||||
*/
|
||||
int (*legal)(unsigned port);
|
||||
/**
|
||||
* Number of controllers connected to this port.
|
||||
*/
|
||||
unsigned controllers;
|
||||
/**
|
||||
* Translate controller and logical button id pair into physical button id.
|
||||
*
|
||||
* Parameter controller: The number of controller.
|
||||
* Parameter lbid: Logigal button ID.
|
||||
* Returns: The physical button ID, or -1 if no such button exists.
|
||||
*/
|
||||
int (*button_id)(unsigned controller, unsigned lbid);
|
||||
/**
|
||||
* Set this controller as core controller.
|
||||
*
|
||||
* Parameter port: Port to set to.
|
||||
*/
|
||||
void (*set_core_controller)(unsigned port);
|
||||
/**
|
||||
* Does the controller exist?
|
||||
*
|
||||
* Parameter controller: Controller number.
|
||||
*/
|
||||
bool is_present(unsigned controller) const throw();
|
||||
/**
|
||||
* Does the controller have analog function?
|
||||
*
|
||||
* Parameter controller: Controller number.
|
||||
*/
|
||||
bool is_analog(unsigned controller) const throw();
|
||||
/**
|
||||
* Does the controller have mouse-type function?
|
||||
*
|
||||
* Parameter controller: Controller number.
|
||||
*/
|
||||
bool is_mouse(unsigned controller) const throw();
|
||||
/**
|
||||
* Human-readable name.
|
||||
*/
|
||||
std::string hname;
|
||||
/**
|
||||
* Number of bytes it takes to store this.
|
||||
*/
|
||||
size_t storage_size;
|
||||
/**
|
||||
* Name of port type.
|
||||
*/
|
||||
std::string name;
|
||||
/**
|
||||
* Name of controller.
|
||||
*/
|
||||
std::string ctrlname;
|
||||
/**
|
||||
* Id of the port.
|
||||
*/
|
||||
unsigned pt_id;
|
||||
private:
|
||||
porttype_info(const porttype_info&);
|
||||
porttype_info& operator=(const porttype_info&);
|
||||
};
|
||||
|
||||
/**
|
||||
* Poll counter vector.
|
||||
*/
|
||||
|
@ -439,7 +193,7 @@ public:
|
|||
*
|
||||
* Throws std::runtime_error: Invalid port type.
|
||||
*/
|
||||
controller_frame(porttype_info& p1, porttype_info& p2) throw(std::runtime_error);
|
||||
controller_frame(port_type& p1, port_type& p2) throw(std::runtime_error);
|
||||
/**
|
||||
* Create subframe of controls with specified controller types and specified memory.
|
||||
*
|
||||
|
@ -449,7 +203,7 @@ public:
|
|||
*
|
||||
* Throws std::runtime_error: Invalid port type or NULL memory.
|
||||
*/
|
||||
controller_frame(unsigned char* memory, porttype_info& p1, porttype_info& p2)
|
||||
controller_frame(unsigned char* memory, port_type& p1, port_type& p2)
|
||||
throw(std::runtime_error);
|
||||
/**
|
||||
* Copy construct a frame. The memory will be dedicated.
|
||||
|
@ -471,9 +225,10 @@ public:
|
|||
* Parameter port: Number of port.
|
||||
* Returns: The type of port.
|
||||
*/
|
||||
porttype_info& get_port_type(unsigned port) throw()
|
||||
port_type& get_port_type(unsigned port) throw()
|
||||
{
|
||||
return (port < MAX_PORTS) ? *types[port] : porttype_info::default_type();
|
||||
//FIXME: Return proper types.
|
||||
return (port < MAX_PORTS) ? *types[port] : get_dummy_port_type();
|
||||
}
|
||||
/**
|
||||
* Get blank dedicated frame of same port types.
|
||||
|
@ -491,7 +246,7 @@ public:
|
|||
* Parameter type: The new type.
|
||||
* Throws std::runtime_error: Bad port type or non-dedicated memory.
|
||||
*/
|
||||
void set_port_type(unsigned port, porttype_info& ptype) throw(std::runtime_error);
|
||||
void set_port_type(unsigned port, port_type& ptype) throw(std::runtime_error);
|
||||
/**
|
||||
* Check that types match.
|
||||
*
|
||||
|
@ -777,11 +532,11 @@ private:
|
|||
size_t totalsize;
|
||||
unsigned char memory[MAXIMUM_CONTROLLER_FRAME_SIZE];
|
||||
unsigned char* backing;
|
||||
porttype_info* types[MAX_PORTS];
|
||||
port_type* types[MAX_PORTS];
|
||||
size_t offsets[MAX_PORTS];
|
||||
static size_t system_serialize(const unsigned char* buffer, char* textbuf);
|
||||
static size_t system_deserialize(unsigned char* buffer, const char* textbuf);
|
||||
void set_types(porttype_info** tarr);
|
||||
void set_types(port_type** tarr);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -801,7 +556,7 @@ public:
|
|||
* Parameter p2: Type of port 2.
|
||||
* Throws std::runtime_error: Illegal port types.
|
||||
*/
|
||||
controller_frame_vector(porttype_info& p1, porttype_info& p2) throw(std::runtime_error);
|
||||
controller_frame_vector(port_type& p1, port_type& p2) throw(std::runtime_error);
|
||||
/**
|
||||
* Destroy controller frame vector
|
||||
*/
|
||||
|
@ -828,7 +583,7 @@ public:
|
|||
* Parameter p2: Type of port 2.
|
||||
* Throws std::runtime_error: Illegal port types.
|
||||
*/
|
||||
void clear(porttype_info& p1, porttype_info& p2) throw(std::runtime_error);
|
||||
void clear(port_type& p1, port_type& p2) throw(std::runtime_error);
|
||||
/**
|
||||
* Blank vector.
|
||||
*/
|
||||
|
@ -935,7 +690,7 @@ private:
|
|||
size_t frames_per_page;
|
||||
size_t frame_size;
|
||||
size_t frames;
|
||||
porttype_info* types[MAX_PORTS];
|
||||
port_type* types[MAX_PORTS];
|
||||
size_t cache_page_num;
|
||||
page* cache_page;
|
||||
std::map<size_t, page> pages;
|
||||
|
@ -994,7 +749,7 @@ public:
|
|||
* Parameter set_core: If true, set the core port type too, otherwise don't do that.
|
||||
* Throws std::runtime_error: Illegal port type.
|
||||
*/
|
||||
void set_port(unsigned port, porttype_info& ptype, bool set_core) throw(std::runtime_error);
|
||||
void set_port(unsigned port, port_type& ptype, bool set_core) throw(std::runtime_error);
|
||||
/**
|
||||
* Get status of current controls (with autohold/autofire factored in).
|
||||
*
|
||||
|
@ -1119,7 +874,7 @@ public:
|
|||
*/
|
||||
bool is_mouse(unsigned pcid) throw();
|
||||
private:
|
||||
porttype_info* porttypes[MAX_PORTS];
|
||||
port_type* porttypes[MAX_PORTS];
|
||||
int analog_indices[MAX_ANALOG];
|
||||
bool analog_mouse[MAX_ANALOG];
|
||||
controller_frame _input;
|
||||
|
@ -1129,142 +884,5 @@ private:
|
|||
std::vector<controller_frame> _autofire;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic port write function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned analog_axis, unsigned buttons>
|
||||
inline void generic_port_write(unsigned char* buffer, unsigned idx, unsigned ctrl, short x) throw()
|
||||
{
|
||||
if(idx >= controllers)
|
||||
return;
|
||||
if(ctrl < analog_axis) {
|
||||
buffer[2 * idx * analog_axis + 2 * ctrl] = (x >> 8);
|
||||
buffer[2 * idx * analog_axis + 2 * ctrl + 1] = x;
|
||||
} else if(ctrl < analog_axis + buttons) {
|
||||
size_t bit = 16 * controllers * analog_axis + idx * buttons + ctrl - analog_axis;
|
||||
if(x)
|
||||
buffer[bit / 8] |= (1 << (bit % 8));
|
||||
else
|
||||
buffer[bit / 8] &= ~(1 << (bit % 8));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic port read function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned analog_axis, unsigned buttons>
|
||||
inline short generic_port_read(const unsigned char* buffer, unsigned idx, unsigned ctrl) throw()
|
||||
{
|
||||
if(idx >= controllers)
|
||||
return 0;
|
||||
if(ctrl < analog_axis) {
|
||||
uint16_t a = buffer[2 * idx * analog_axis + 2 * ctrl];
|
||||
uint16_t b = buffer[2 * idx * analog_axis + 2 * ctrl + 1];
|
||||
return static_cast<short>(256 * a + b);
|
||||
} else if(ctrl < analog_axis + buttons) {
|
||||
size_t bit = 16 * controllers * analog_axis + idx * buttons + ctrl - analog_axis;
|
||||
return ((buffer[bit / 8] & (1 << (bit % 8))) != 0);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern const char* button_symbols;
|
||||
|
||||
/**
|
||||
* Generic port display function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned analog_axis, unsigned buttons, unsigned sidx>
|
||||
inline void generic_port_display(const unsigned char* buffer, unsigned idx, char* buf) throw()
|
||||
{
|
||||
if(idx > controllers) {
|
||||
buf[0] = '\0';
|
||||
return;
|
||||
}
|
||||
size_t ptr = 0;
|
||||
for(unsigned i = 0; i < analog_axis; i++) {
|
||||
uint16_t a = buffer[2 * idx * analog_axis + 2 * i];
|
||||
uint16_t b = buffer[2 * idx * analog_axis + 2 * i + 1];
|
||||
ptr += sprintf(buf + ptr, "%i ", static_cast<short>(256 * a + b));
|
||||
}
|
||||
for(unsigned i = 0; i < buttons; i++) {
|
||||
size_t bit = 16 * controllers * analog_axis + idx * buttons + i;
|
||||
buf[ptr++] = ((buffer[bit / 8] & (1 << (bit % 8))) != 0) ? button_symbols[i + sidx] : '-';
|
||||
}
|
||||
buf[ptr] = '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic port serialization function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned analog_axis, unsigned buttons, unsigned sidx>
|
||||
inline size_t generic_port_serialize(const unsigned char* buffer, char* textbuf) throw()
|
||||
{
|
||||
size_t ptr = 0;
|
||||
for(unsigned j = 0; j < controllers; j++) {
|
||||
textbuf[ptr++] = '|';
|
||||
for(unsigned i = 0; i < buttons; i++) {
|
||||
size_t bit = 16 * controllers * analog_axis + j * buttons + i;
|
||||
textbuf[ptr++] = ((buffer[bit / 8] & (1 << (bit % 8))) != 0) ? button_symbols[i + sidx] : '.';
|
||||
}
|
||||
for(unsigned i = 0; i < analog_axis; i++) {
|
||||
uint16_t a = buffer[2 * j * analog_axis + 2 * i];
|
||||
uint16_t b = buffer[2 * j * analog_axis + 2 * i + 1];
|
||||
ptr += sprintf(textbuf + ptr, " %i", static_cast<short>(256 * a + b));
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic port size function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned analog_axis, unsigned buttons>
|
||||
inline size_t generic_port_size()
|
||||
{
|
||||
return 2 * controllers * analog_axis + (controllers * buttons + 7) / 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic port deserialization function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned analog_axis, unsigned buttons>
|
||||
inline size_t generic_port_deserialize(unsigned char* buffer, const char* textbuf) throw()
|
||||
{
|
||||
if(!controllers)
|
||||
return DESERIALIZE_SPECIAL_BLANK;
|
||||
memset(buffer, 0, generic_port_size<controllers, analog_axis, buttons>());
|
||||
size_t ptr = 0;
|
||||
for(unsigned j = 0; j < controllers; j++) {
|
||||
for(unsigned i = 0; i < buttons; i++) {
|
||||
size_t bit = 16 * controllers * analog_axis + j * buttons + i;
|
||||
if(read_button_value(textbuf, ptr))
|
||||
buffer[bit / 8] |= (1 << (bit % 8));
|
||||
}
|
||||
for(unsigned i = 0; i < analog_axis; i++) {
|
||||
short v = read_axis_value(textbuf, ptr);
|
||||
buffer[2 * j * analog_axis + 2 * i] = v >> 8;
|
||||
buffer[2 * j * analog_axis + 2 * i + 1] = v;
|
||||
}
|
||||
skip_rest_of_field(textbuf, ptr, j + 1 < controllers);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template<unsigned mask>
|
||||
inline int generic_port_legal(unsigned port) throw()
|
||||
{
|
||||
if(port >= CHAR_BIT * sizeof(unsigned))
|
||||
port = CHAR_BIT * sizeof(unsigned) - 1;
|
||||
return ((mask >> port) & 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic port type function.
|
||||
*/
|
||||
template<unsigned controllers, unsigned flags>
|
||||
inline unsigned generic_port_deviceflags(unsigned idx) throw()
|
||||
{
|
||||
return (idx < controllers) ? flags : 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
#include "library/framebuffer.hpp"
|
||||
#include "library/controller-data.hpp"
|
||||
#include "core/romtype.hpp"
|
||||
|
||||
|
||||
|
@ -71,6 +72,8 @@ std::pair<uint64_t, uint64_t> core_get_bus_map();
|
|||
unsigned core_get_poll_flag();
|
||||
//Set poll flag (set to 1 on each real poll, except if 2.
|
||||
void core_set_poll_flag(unsigned pflag);
|
||||
//The port type group.
|
||||
extern port_type_group core_portgroup;
|
||||
|
||||
/**
|
||||
* Get name of logical button.
|
||||
|
|
|
@ -52,11 +52,11 @@ struct moviefile
|
|||
/**
|
||||
* What's in port #1?
|
||||
*/
|
||||
porttype_info* port1;
|
||||
port_type* port1;
|
||||
/**
|
||||
* What's in port #2?
|
||||
*/
|
||||
porttype_info* port2;
|
||||
port_type* port2;
|
||||
/**
|
||||
* Emulator Core version string.
|
||||
*/
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
|
||||
const char* button_symbols = "BYsSudlrAXLRTSTCUP";
|
||||
|
||||
port_type_group core_portgroup;
|
||||
|
||||
namespace
|
||||
{
|
||||
bool pollflag_active = true;
|
||||
|
@ -558,9 +560,9 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
struct porttype_gamepad : public porttype_info
|
||||
struct porttype_gamepad : public port_type
|
||||
{
|
||||
porttype_gamepad() : porttype_info("gamepad", "Gamepad", 1, generic_port_size<1, 0, 12>())
|
||||
porttype_gamepad() : port_type(core_portgroup, "gamepad", "Gamepad", 1, generic_port_size<1, 0, 12>())
|
||||
{
|
||||
write = generic_port_write<1, 0, 12>;
|
||||
read = generic_port_read<1, 0, 12>;
|
||||
|
@ -573,12 +575,14 @@ namespace
|
|||
ctrlname = "gamepad";
|
||||
controllers = 1;
|
||||
set_core_controller = set_core_controller_gamepad;
|
||||
core_portgroup.set_default(0, *this);
|
||||
}
|
||||
} gamepad;
|
||||
|
||||
struct porttype_justifier : public porttype_info
|
||||
struct porttype_justifier : public port_type
|
||||
{
|
||||
porttype_justifier() : porttype_info("justifier", "Justifier", 5, generic_port_size<1, 2, 2>())
|
||||
porttype_justifier() : port_type(core_portgroup, "justifier", "Justifier", 5,
|
||||
generic_port_size<1, 2, 2>())
|
||||
{
|
||||
write = generic_port_write<1, 2, 2>;
|
||||
read = generic_port_read<1, 2, 2>;
|
||||
|
@ -594,9 +598,10 @@ namespace
|
|||
}
|
||||
} justifier;
|
||||
|
||||
struct porttype_justifiers : public porttype_info
|
||||
struct porttype_justifiers : public port_type
|
||||
{
|
||||
porttype_justifiers() : porttype_info("justifiers", "2 Justifiers", 6, generic_port_size<2, 2, 2>())
|
||||
porttype_justifiers() : port_type(core_portgroup, "justifiers", "2 Justifiers", 6,
|
||||
generic_port_size<2, 2, 2>())
|
||||
{
|
||||
write = generic_port_write<2, 2, 2>;
|
||||
read = generic_port_read<2, 2, 2>;
|
||||
|
@ -612,9 +617,9 @@ namespace
|
|||
}
|
||||
} justifiers;
|
||||
|
||||
struct porttype_mouse : public porttype_info
|
||||
struct porttype_mouse : public port_type
|
||||
{
|
||||
porttype_mouse() : porttype_info("mouse", "Mouse", 3, generic_port_size<1, 2, 2>())
|
||||
porttype_mouse() : port_type(core_portgroup, "mouse", "Mouse", 3, generic_port_size<1, 2, 2>())
|
||||
{
|
||||
write = generic_port_write<1, 2, 2>;
|
||||
read = generic_port_read<1, 2, 2>;
|
||||
|
@ -630,9 +635,9 @@ namespace
|
|||
}
|
||||
} mouse;
|
||||
|
||||
struct porttype_multitap : public porttype_info
|
||||
struct porttype_multitap : public port_type
|
||||
{
|
||||
porttype_multitap() : porttype_info("multitap", "Multitap", 2, generic_port_size<4, 0, 12>())
|
||||
porttype_multitap() : port_type(core_portgroup, "multitap", "Multitap", 2, generic_port_size<4, 0, 12>())
|
||||
{
|
||||
write = generic_port_write<4, 0, 12>;
|
||||
read = generic_port_read<4, 0, 12>;
|
||||
|
@ -648,9 +653,9 @@ namespace
|
|||
}
|
||||
} multitap;
|
||||
|
||||
struct porttype_none : public porttype_info
|
||||
struct porttype_none : public port_type
|
||||
{
|
||||
porttype_none() : porttype_info("none", "None", 0, generic_port_size<0, 0, 0>())
|
||||
porttype_none() : port_type(core_portgroup, "none", "None", 0, generic_port_size<0, 0, 0>())
|
||||
{
|
||||
write = generic_port_write<0, 0, 0>;
|
||||
read = generic_port_read<0, 0, 0>;
|
||||
|
@ -663,12 +668,14 @@ namespace
|
|||
ctrlname = "";
|
||||
controllers = 0;
|
||||
set_core_controller = set_core_controller_none;
|
||||
core_portgroup.set_default(1, *this);
|
||||
}
|
||||
} none;
|
||||
|
||||
struct porttype_superscope : public porttype_info
|
||||
struct porttype_superscope : public port_type
|
||||
{
|
||||
porttype_superscope() : porttype_info("superscope", "Super Scope", 4, generic_port_size<1, 2, 4>())
|
||||
porttype_superscope() : port_type(core_portgroup, "superscope", "Super Scope", 4,
|
||||
generic_port_size<1, 2, 4>())
|
||||
{
|
||||
write = generic_port_write<1, 2, 4>;
|
||||
read = generic_port_read<1, 2, 4>;
|
||||
|
|
|
@ -11,115 +11,12 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
std::set<porttype_info*>& porttypes()
|
||||
{
|
||||
static std::set<porttype_info*> p;
|
||||
return p;
|
||||
}
|
||||
|
||||
void set_core_controller_illegal(unsigned port) throw()
|
||||
{
|
||||
std::cerr << "Attempt to set core port type to INVALID port type" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int button_id_illegal(unsigned controller, unsigned lbid)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct porttype_invalid : public porttype_info
|
||||
{
|
||||
porttype_invalid() : porttype_info("invalid-port-type", "invalid-port-type", 99999, 0)
|
||||
{
|
||||
write = NULL;
|
||||
read = NULL;
|
||||
display = NULL;
|
||||
serialize = NULL;
|
||||
deserialize = NULL;
|
||||
legal = NULL;
|
||||
deviceflags = generic_port_deviceflags<0, 0>;
|
||||
button_id = button_id_illegal;
|
||||
ctrlname = "";
|
||||
controllers = 0;
|
||||
set_core_controller = set_core_controller_illegal;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
porttype_invalid& get_invalid_port_type()
|
||||
{
|
||||
static porttype_invalid inv;
|
||||
return inv;
|
||||
}
|
||||
|
||||
bool compare_porttype(porttype_info* a, porttype_info* b)
|
||||
bool compare_porttype(port_type* a, port_type* b)
|
||||
{
|
||||
return (a->pt_id < b->pt_id);
|
||||
}
|
||||
}
|
||||
|
||||
porttype_info& porttype_info::lookup(const std::string& p) throw(std::runtime_error)
|
||||
{
|
||||
get_invalid_port_type();
|
||||
for(auto i : porttypes())
|
||||
if(p == i->name && i->legal)
|
||||
return *i;
|
||||
throw std::runtime_error("Bad port type");
|
||||
}
|
||||
|
||||
porttype_info& porttype_info::port_default(unsigned port)
|
||||
{
|
||||
return lookup(get_core_default_port(port));
|
||||
}
|
||||
|
||||
porttype_info::~porttype_info() throw()
|
||||
{
|
||||
porttypes().erase(this);
|
||||
}
|
||||
|
||||
porttype_info::porttype_info(const std::string& pname, const std::string& _hname, unsigned _pt_id, size_t psize)
|
||||
throw(std::bad_alloc)
|
||||
{
|
||||
name = pname;
|
||||
hname = _hname;
|
||||
storage_size = psize;
|
||||
pt_id = _pt_id;
|
||||
porttypes().insert(this);
|
||||
}
|
||||
|
||||
porttype_info& porttype_info::default_type()
|
||||
{
|
||||
return get_invalid_port_type();
|
||||
}
|
||||
|
||||
std::list<porttype_info*> porttype_info::get_all()
|
||||
{
|
||||
std::list<porttype_info*> p;
|
||||
for(auto i : porttypes())
|
||||
if(i->legal)
|
||||
p.push_back(i);
|
||||
p.sort(compare_porttype);
|
||||
return p;
|
||||
}
|
||||
|
||||
bool porttype_info::is_present(unsigned controller) const throw()
|
||||
{
|
||||
unsigned d = deviceflags(controller);
|
||||
return ((d & 1) != 0);
|
||||
}
|
||||
|
||||
bool porttype_info::is_analog(unsigned controller) const throw()
|
||||
{
|
||||
unsigned d = deviceflags(controller);
|
||||
return ((d & 1) != 0) && ((d & 6) != 0);
|
||||
}
|
||||
|
||||
bool porttype_info::is_mouse(unsigned controller) const throw()
|
||||
{
|
||||
return ((deviceflags(controller) & 5) == 5);
|
||||
}
|
||||
|
||||
pollcounter_vector::pollcounter_vector() throw()
|
||||
{
|
||||
clear();
|
||||
|
@ -215,7 +112,7 @@ bool pollcounter_vector::check(const std::vector<uint32_t>& mem) throw()
|
|||
}
|
||||
|
||||
|
||||
controller_frame::controller_frame(porttype_info& p1, porttype_info& p2) throw(std::runtime_error)
|
||||
controller_frame::controller_frame(port_type& p1, port_type& p2) throw(std::runtime_error)
|
||||
{
|
||||
memset(memory, 0, sizeof(memory));
|
||||
backing = memory;
|
||||
|
@ -224,7 +121,7 @@ controller_frame::controller_frame(porttype_info& p1, porttype_info& p2) throw(s
|
|||
set_types(types);
|
||||
}
|
||||
|
||||
controller_frame::controller_frame(unsigned char* mem, porttype_info& p1, porttype_info& p2) throw(std::runtime_error)
|
||||
controller_frame::controller_frame(unsigned char* mem, port_type& p1, port_type& p2) throw(std::runtime_error)
|
||||
{
|
||||
if(!mem)
|
||||
throw std::runtime_error("NULL backing memory not allowed");
|
||||
|
@ -239,17 +136,17 @@ controller_frame::controller_frame(const controller_frame& obj) throw()
|
|||
{
|
||||
memset(memory, 0, sizeof(memory));
|
||||
backing = memory;
|
||||
set_types(const_cast<porttype_info**>(obj.types));
|
||||
set_types(const_cast<port_type**>(obj.types));
|
||||
memcpy(backing, obj.backing, totalsize);
|
||||
}
|
||||
|
||||
controller_frame& controller_frame::operator=(const controller_frame& obj) throw(std::runtime_error)
|
||||
{
|
||||
set_types(const_cast<porttype_info**>(obj.types));
|
||||
set_types(const_cast<port_type**>(obj.types));
|
||||
memcpy(backing, obj.backing, totalsize);
|
||||
}
|
||||
|
||||
void controller_frame::set_types(porttype_info** tarr)
|
||||
void controller_frame::set_types(port_type** tarr)
|
||||
{
|
||||
for(unsigned i = 0; i < MAX_PORTS; i++) {
|
||||
if(memory != backing && types[i] != tarr[i])
|
||||
|
@ -319,7 +216,7 @@ size_t controller_frame_vector::count_frames() throw()
|
|||
return ret;
|
||||
}
|
||||
|
||||
void controller_frame_vector::clear(porttype_info& p1, porttype_info& p2) throw(std::runtime_error)
|
||||
void controller_frame_vector::clear(port_type& p1, port_type& p2) throw(std::runtime_error)
|
||||
{
|
||||
controller_frame check(p1, p2);
|
||||
frame_size = check.size();
|
||||
|
@ -339,10 +236,10 @@ controller_frame_vector::~controller_frame_vector() throw()
|
|||
|
||||
controller_frame_vector::controller_frame_vector() throw(std::runtime_error)
|
||||
{
|
||||
clear(porttype_info::default_type(), porttype_info::default_type());
|
||||
clear(get_dummy_port_type(), get_dummy_port_type());
|
||||
}
|
||||
|
||||
controller_frame_vector::controller_frame_vector(porttype_info& p1, porttype_info& p2) throw(std::runtime_error)
|
||||
controller_frame_vector::controller_frame_vector(port_type& p1, port_type& p2) throw(std::runtime_error)
|
||||
{
|
||||
clear(p1, p2);
|
||||
}
|
||||
|
@ -425,39 +322,6 @@ size_t controller_frame::system_deserialize(unsigned char* buffer, const char* t
|
|||
return idx;
|
||||
}
|
||||
|
||||
short read_axis_value(const char* buf, size_t& idx) throw()
|
||||
{
|
||||
char ch;
|
||||
//Skip ws.
|
||||
while(is_nonterminator(buf[idx])) {
|
||||
char ch = buf[idx];
|
||||
if(ch != ' ' && ch != '\t')
|
||||
break;
|
||||
idx++;
|
||||
}
|
||||
//Read the sign if any.
|
||||
ch = buf[idx];
|
||||
if(!is_nonterminator(ch))
|
||||
return 0;
|
||||
bool negative = false;
|
||||
if(ch == '-') {
|
||||
negative = true;
|
||||
idx++;
|
||||
}
|
||||
if(ch == '+')
|
||||
idx++;
|
||||
|
||||
//Read numeric value.
|
||||
int numval = 0;
|
||||
while(is_nonterminator(buf[idx]) && isdigit(static_cast<unsigned char>(ch = buf[idx]))) {
|
||||
numval = numval * 10 + (ch - '0');
|
||||
idx++;
|
||||
}
|
||||
if(negative)
|
||||
numval = -numval;
|
||||
|
||||
return static_cast<short>(numval);
|
||||
}
|
||||
|
||||
void controller_frame_vector::resize(size_t newsize) throw(std::bad_alloc)
|
||||
{
|
||||
|
@ -501,19 +365,19 @@ controller_frame::controller_frame() throw()
|
|||
backing = memory;
|
||||
for(unsigned i = 0; i < MAX_PORTS; i++) {
|
||||
offsets[i] = SYSTEM_BYTES;
|
||||
types[i] = &porttype_info::default_type();
|
||||
types[i] = &get_dummy_port_type();
|
||||
}
|
||||
totalsize = SYSTEM_BYTES;
|
||||
}
|
||||
|
||||
void controller_frame::set_port_type(unsigned port, porttype_info& ptype) throw(std::runtime_error)
|
||||
void controller_frame::set_port_type(unsigned port, port_type& ptype) throw(std::runtime_error)
|
||||
{
|
||||
char tmp[MAXIMUM_CONTROLLER_FRAME_SIZE] = {0};
|
||||
if(memory != backing)
|
||||
throw std::runtime_error("Can't set port type on non-dedicated controller frame");
|
||||
if(port >= MAX_PORTS)
|
||||
return;
|
||||
porttype_info* newpinfo[MAX_PORTS];
|
||||
port_type* newpinfo[MAX_PORTS];
|
||||
size_t newoffsets[MAX_PORTS];
|
||||
size_t offset = SYSTEM_BYTES;
|
||||
for(size_t i = 0; i < MAX_PORTS; i++) {
|
||||
|
@ -541,7 +405,7 @@ controller_state::controller_state() throw()
|
|||
analog_mouse[i] = false;
|
||||
}
|
||||
for(size_t i = 0; i < MAX_PORTS; i++) {
|
||||
porttypes[i] = &porttype_info::default_type();
|
||||
porttypes[i] = &get_dummy_port_type();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -660,14 +524,14 @@ int controller_state::button_id(unsigned pcid, unsigned lbid) throw()
|
|||
return porttypes[port]->button_id(pcid % MAX_CONTROLLERS_PER_PORT, lbid);
|
||||
}
|
||||
|
||||
void controller_state::set_port(unsigned port, porttype_info& ptype, bool set_core) throw(std::runtime_error)
|
||||
void controller_state::set_port(unsigned port, port_type& ptype, bool set_core) throw(std::runtime_error)
|
||||
{
|
||||
if(port >= MAX_PORTS)
|
||||
throw std::runtime_error("Port number invalid");
|
||||
porttype_info* info = &ptype;
|
||||
port_type* info = &ptype;
|
||||
if(set_core)
|
||||
info->set_core_controller(port);
|
||||
porttype_info* oldtype = porttypes[port];
|
||||
port_type* oldtype = porttypes[port];
|
||||
if(oldtype != &ptype) {
|
||||
_input.set_port_type(port, ptype);
|
||||
_autohold.set_port_type(port, ptype);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define LOGICAL_BUTTON_START 7
|
||||
|
||||
const char* button_symbols = "ABsSrlud";
|
||||
port_type_group core_portgroup;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -187,10 +188,11 @@ namespace
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct porttype_gamepad : public porttype_info
|
||||
|
||||
struct porttype_gamepad : public port_type
|
||||
{
|
||||
porttype_gamepad() : porttype_info("gamepad", "Gamepad", 1, generic_port_size<1, 0, 8>())
|
||||
porttype_gamepad() : port_type(core_portgroup, "gamepad", "Gamepad", 1,
|
||||
generic_port_size<1, 0, 8>())
|
||||
{
|
||||
write = generic_port_write<1, 0, 8>;
|
||||
read = generic_port_read<1, 0, 8>;
|
||||
|
@ -203,13 +205,14 @@ namespace
|
|||
ctrlname = "gamepad";
|
||||
controllers = 1;
|
||||
set_core_controller = _set_core_controller;
|
||||
core_portgroup.set_default(0, *this);
|
||||
}
|
||||
|
||||
} gamepad;
|
||||
|
||||
struct porttype_none : public porttype_info
|
||||
struct porttype_none : public port_type
|
||||
{
|
||||
porttype_none() : porttype_info("none", "None", 0, generic_port_size<0, 0, 0>())
|
||||
porttype_none() : port_type(core_portgroup, "none", "None", 0, generic_port_size<0, 0, 0>())
|
||||
{
|
||||
write = generic_port_write<0, 0, 0>;
|
||||
read = generic_port_read<0, 0, 0>;
|
||||
|
@ -222,9 +225,9 @@ namespace
|
|||
ctrlname = "";
|
||||
controllers = 0;
|
||||
set_core_controller = _set_core_controller;
|
||||
core_portgroup.set_default(1, *this);
|
||||
}
|
||||
} none;
|
||||
|
||||
}
|
||||
|
||||
std::string get_logical_button_name(unsigned lbid) throw(std::bad_alloc)
|
||||
|
|
|
@ -322,10 +322,10 @@ void write_pollcounters(zip_writer& w, const std::string& file, const std::vecto
|
|||
}
|
||||
}
|
||||
|
||||
porttype_info& parse_controller_type(const std::string& type, unsigned port) throw(std::bad_alloc, std::runtime_error)
|
||||
port_type& parse_controller_type(const std::string& type, unsigned port) throw(std::bad_alloc, std::runtime_error)
|
||||
{
|
||||
try {
|
||||
porttype_info& i = porttype_info::lookup(type);
|
||||
port_type& i = core_portgroup.get_type(type);
|
||||
if(!i.legal || !(i.legal(port)))
|
||||
throw 42;
|
||||
return i;
|
||||
|
@ -338,8 +338,8 @@ moviefile::moviefile() throw(std::bad_alloc)
|
|||
{
|
||||
force_corrupt = false;
|
||||
gametype = NULL;
|
||||
port1 = &porttype_info::default_type();
|
||||
port2 = &porttype_info::default_type();
|
||||
port1 = &get_dummy_port_type();
|
||||
port2 = &get_dummy_port_type();
|
||||
coreversion = "";
|
||||
projectid = "";
|
||||
rerecords = "0";
|
||||
|
@ -374,12 +374,12 @@ moviefile::moviefile(const std::string& movie) throw(std::bad_alloc, std::runtim
|
|||
} catch(std::exception& e) {
|
||||
throw std::runtime_error("Illegal game type '" + tmp + "'");
|
||||
}
|
||||
tmp = porttype_info::port_default(0).name;
|
||||
tmp = core_portgroup.get_default_type(0).name;
|
||||
read_linefile(r, "port1", tmp, true);
|
||||
port1 = &porttype_info::lookup(tmp);
|
||||
tmp = porttype_info::port_default(1).name;
|
||||
port1 = &core_portgroup.get_type(tmp);
|
||||
tmp = core_portgroup.get_default_type(1).name;
|
||||
read_linefile(r, "port2", tmp, true);
|
||||
port2 = &porttype_info::lookup(tmp);
|
||||
port2 = &core_portgroup.get_type(tmp);
|
||||
input.clear(*port1, *port2);
|
||||
read_linefile(r, "gamename", gamename, true);
|
||||
read_linefile(r, "projectid", projectid);
|
||||
|
@ -445,9 +445,9 @@ void moviefile::save(const std::string& movie, unsigned compression) throw(std::
|
|||
{
|
||||
zip_writer w(movie, compression);
|
||||
write_linefile(w, "gametype", gametype->get_name());
|
||||
if(port1->name != porttype_info::port_default(0).name)
|
||||
if(port1->name != core_portgroup.get_default_type(0).name)
|
||||
write_linefile(w, "port1", port1->name);
|
||||
if(port2->name != porttype_info::port_default(1).name)
|
||||
if(port2->name != core_portgroup.get_default_type(1).name)
|
||||
write_linefile(w, "port2", port2->name);
|
||||
write_linefile(w, "gamename", gamename, true);
|
||||
write_linefile(w, "systemid", "lsnes-rr1");
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace
|
|||
unsigned controller = get_numeric_argument<unsigned>(LS, 1, fname.c_str());
|
||||
auto& m = get_movie();
|
||||
controller_frame f = m.read_subframe(m.get_current_frame(), 0);
|
||||
porttype_info& p = f.get_port_type(controller / MAX_CONTROLLERS_PER_PORT);
|
||||
port_type& p = f.get_port_type(controller / MAX_CONTROLLERS_PER_PORT);
|
||||
if(p.controllers <= controller % MAX_CONTROLLERS_PER_PORT)
|
||||
lua_pushnil(LS);
|
||||
else if(p.ctrlname == "")
|
||||
|
|
|
@ -30,8 +30,8 @@ bool dummy_interface = false;
|
|||
struct moviefile generate_movie_template(std::vector<std::string> cmdline, loaded_rom& r)
|
||||
{
|
||||
struct moviefile movie;
|
||||
movie.port1 = &porttype_info::port_default(0);
|
||||
movie.port2 = &porttype_info::port_default(1);
|
||||
movie.port1 = &core_portgroup.get_default_type(0);
|
||||
movie.port2 = &core_portgroup.get_default_type(1);
|
||||
movie.coreversion = bsnes_core_version;
|
||||
movie.projectid = get_random_hexstring(40);
|
||||
movie.gametype = &r.rtype->combine_region(*r.region);
|
||||
|
@ -45,9 +45,9 @@ struct moviefile generate_movie_template(std::vector<std::string> cmdline, loade
|
|||
if(o.length() >= 9 && o.substr(0, 9) == "--prefix=")
|
||||
movie.prefix = sanitize_prefix(o.substr(9));
|
||||
if(o.length() >= 8 && o.substr(0, 8) == "--port1=")
|
||||
movie.port1 = &porttype_info::lookup(o.substr(8));
|
||||
movie.port1 = &core_portgroup.get_type(o.substr(8));
|
||||
if(o.length() >= 8 && o.substr(0, 8) == "--port2=")
|
||||
movie.port2 = &porttype_info::lookup(o.substr(8));
|
||||
movie.port2 = &core_portgroup.get_type(o.substr(8));
|
||||
if(o.length() >= 11 && o.substr(0, 11) == "--gamename=")
|
||||
movie.gamename = o.substr(11);
|
||||
if(o.length() >= 9 && o.substr(0, 9) == "--author=") {
|
||||
|
|
|
@ -367,8 +367,8 @@ bool lsnes_app::OnInit()
|
|||
messages << "BSNES version: " << bsnes_core_version << std::endl;
|
||||
messages << "lsnes version: lsnes rr" << lsnes_version << std::endl;
|
||||
|
||||
controls.set_port(0, porttype_info::port_default(0), false);
|
||||
controls.set_port(1, porttype_info::port_default(1), false);
|
||||
controls.set_port(0, core_portgroup.get_default_type(0), false);
|
||||
controls.set_port(1, core_portgroup.get_default_type(1), false);
|
||||
|
||||
std::string cfgpath = get_config_path();
|
||||
messages << "Saving per-user data to: " << get_config_path() << std::endl;
|
||||
|
@ -423,8 +423,8 @@ bool lsnes_app::OnInit()
|
|||
}
|
||||
else {
|
||||
mov = new moviefile;
|
||||
mov->port1 = &porttype_info::port_default(0);
|
||||
mov->port2 = &porttype_info::port_default(1);
|
||||
mov->port1 = &core_portgroup.get_default_type(0);
|
||||
mov->port2 = &core_portgroup.get_default_type(1);
|
||||
mov->input.clear(*mov->port1, *mov->port2);
|
||||
if(c_rom != "") {
|
||||
//Initialize the remainder.
|
||||
|
|
|
@ -30,21 +30,21 @@ void patching_done(struct loaded_rom& rom, wxWindow* modwin);
|
|||
|
||||
namespace
|
||||
{
|
||||
porttype_info& get_controller_type(const std::string& s)
|
||||
port_type& get_controller_type(const std::string& s)
|
||||
{
|
||||
auto types = porttype_info::get_all();
|
||||
auto types = core_portgroup.get_types();
|
||||
for(auto i : types)
|
||||
if(s == i->hname)
|
||||
return *i;
|
||||
return porttype_info::default_type();
|
||||
return get_dummy_port_type();
|
||||
}
|
||||
|
||||
void load_cchoices(std::vector<wxString>& cc, unsigned port, unsigned& dfltidx)
|
||||
{
|
||||
cc.clear();
|
||||
porttype_info& dflt = porttype_info::port_default(port);
|
||||
port_type& dflt = core_portgroup.get_default_type(port);
|
||||
dfltidx = 0;
|
||||
auto types = porttype_info::get_all();
|
||||
auto types = core_portgroup.get_types();
|
||||
for(auto i : types)
|
||||
if(i->legal && i->legal(port)) {
|
||||
cc.push_back(towxstring(i->hname));
|
||||
|
|
Loading…
Add table
Reference in a new issue