fix bsnes mouse emulation frontend integration
This commit is contained in:
parent
b1a2e99aff
commit
0338263e4e
|
@ -8,14 +8,19 @@ uint2 Mouse::data() {
|
|||
position_y = interface()->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
}
|
||||
|
||||
|
||||
bool direction_x = position_x < 0; //0 = right, 1 = left
|
||||
bool direction_y = position_y < 0; //0 = down, 1 = up
|
||||
|
||||
int position_x_fixed = position_x;
|
||||
int position_y_fixed = position_y;
|
||||
|
||||
if(position_x < 0) position_x_fixed = -position_x; //abs(position_x)
|
||||
if(position_y < 0) position_y_fixed = -position_y; //abs(position_y)
|
||||
|
||||
if(position_x < 0) position_x = -position_x; //abs(position_x)
|
||||
if(position_y < 0) position_y = -position_y; //abs(position_y)
|
||||
position_x_fixed = min(127, position_x_fixed); //range = 0 - 127
|
||||
position_y_fixed = min(127, position_y_fixed);
|
||||
|
||||
position_x = min(127, position_x); //range = 0 - 127
|
||||
position_y = min(127, position_y);
|
||||
|
||||
switch(counter++) { default:
|
||||
case 0: return 0;
|
||||
|
@ -37,23 +42,23 @@ uint2 Mouse::data() {
|
|||
case 14: return 0; // ||
|
||||
case 15: return 1; // ||
|
||||
|
||||
case 16: return (direction_y);
|
||||
case 17: return (position_y >> 6) & 1;
|
||||
case 18: return (position_y >> 5) & 1;
|
||||
case 19: return (position_y >> 4) & 1;
|
||||
case 20: return (position_y >> 3) & 1;
|
||||
case 21: return (position_y >> 2) & 1;
|
||||
case 22: return (position_y >> 1) & 1;
|
||||
case 23: return (position_y >> 0) & 1;
|
||||
case 16: return (direction_y)?1:0;
|
||||
case 17: return (position_y_fixed >> 6) & 1;
|
||||
case 18: return (position_y_fixed >> 5) & 1;
|
||||
case 19: return (position_y_fixed >> 4) & 1;
|
||||
case 20: return (position_y_fixed >> 3) & 1;
|
||||
case 21: return (position_y_fixed >> 2) & 1;
|
||||
case 22: return (position_y_fixed >> 1) & 1;
|
||||
case 23: return (position_y_fixed >> 0) & 1;
|
||||
|
||||
case 24: return (direction_x);
|
||||
case 25: return (position_x >> 6) & 1;
|
||||
case 26: return (position_x >> 5) & 1;
|
||||
case 27: return (position_x >> 4) & 1;
|
||||
case 28: return (position_x >> 3) & 1;
|
||||
case 29: return (position_x >> 2) & 1;
|
||||
case 30: return (position_x >> 1) & 1;
|
||||
case 31: return (position_x >> 0) & 1;
|
||||
case 24: return (direction_x) ? 1 : 0;
|
||||
case 25: return (position_x_fixed >> 6) & 1;
|
||||
case 26: return (position_x_fixed >> 5) & 1;
|
||||
case 27: return (position_x_fixed >> 4) & 1;
|
||||
case 28: return (position_x_fixed >> 3) & 1;
|
||||
case 29: return (position_x_fixed >> 2) & 1;
|
||||
case 30: return (position_x_fixed >> 1) & 1;
|
||||
case 31: return (position_x_fixed >> 0) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue