mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Merge pull request #803 from ChuckRozhon/cast_from_double_to_u8_warnings
Removed warnings by explicitly casting to `u8` for controllers
This commit is contained in:
commit
bac9634fde
@ -103,17 +103,17 @@ void GCPad::GetInput(GCPadStatus* const pad)
|
||||
|
||||
// sticks
|
||||
m_main_stick->GetState(&x, &y);
|
||||
pad->stickX = GCPadStatus::MAIN_STICK_CENTER_X + (x * GCPadStatus::MAIN_STICK_RADIUS);
|
||||
pad->stickY = GCPadStatus::MAIN_STICK_CENTER_Y + (y * GCPadStatus::MAIN_STICK_RADIUS);
|
||||
pad->stickX = GCPadStatus::MAIN_STICK_CENTER_X + (u8)(x * GCPadStatus::MAIN_STICK_RADIUS);
|
||||
pad->stickY = GCPadStatus::MAIN_STICK_CENTER_Y + (u8)(y * GCPadStatus::MAIN_STICK_RADIUS);
|
||||
|
||||
m_c_stick->GetState(&x, &y);
|
||||
pad->substickX = GCPadStatus::C_STICK_CENTER_X + (x * GCPadStatus::C_STICK_RADIUS);
|
||||
pad->substickY = GCPadStatus::C_STICK_CENTER_Y + (y * GCPadStatus::C_STICK_RADIUS);
|
||||
pad->substickX = GCPadStatus::C_STICK_CENTER_X + (u8)(x * GCPadStatus::C_STICK_RADIUS);
|
||||
pad->substickY = GCPadStatus::C_STICK_CENTER_Y + (u8)(y * GCPadStatus::C_STICK_RADIUS);
|
||||
|
||||
// triggers
|
||||
m_triggers->GetState(&pad->button, trigger_bitmasks, triggers);
|
||||
pad->triggerLeft = triggers[0] * 0xFF;
|
||||
pad->triggerRight = triggers[1] * 0xFF;
|
||||
pad->triggerLeft = (u8)(triggers[0] * 0xFF);
|
||||
pad->triggerRight = (u8)(triggers[1] * 0xFF);
|
||||
}
|
||||
|
||||
void GCPad::SetMotor(const u8 on)
|
||||
|
@ -92,8 +92,8 @@ void Classic::GetState(u8* const data)
|
||||
double x, y;
|
||||
m_left_stick->GetState(&x, &y);
|
||||
|
||||
ccdata->lx = Classic::LEFT_STICK_CENTER_X + (x * Classic::LEFT_STICK_RADIUS);
|
||||
ccdata->ly = Classic::LEFT_STICK_CENTER_Y + (y * Classic::LEFT_STICK_RADIUS);
|
||||
ccdata->lx = Classic::LEFT_STICK_CENTER_X + (u8)(x * Classic::LEFT_STICK_RADIUS);
|
||||
ccdata->ly = Classic::LEFT_STICK_CENTER_Y + (u8)(y * Classic::LEFT_STICK_RADIUS);
|
||||
}
|
||||
|
||||
// right stick
|
||||
@ -102,8 +102,8 @@ void Classic::GetState(u8* const data)
|
||||
u8 x_, y_;
|
||||
m_right_stick->GetState(&x, &y);
|
||||
|
||||
x_ = Classic::RIGHT_STICK_CENTER_X + (x * Classic::RIGHT_STICK_RADIUS);
|
||||
y_ = Classic::RIGHT_STICK_CENTER_Y + (y * Classic::RIGHT_STICK_RADIUS);
|
||||
x_ = Classic::RIGHT_STICK_CENTER_X + (u8)(x * Classic::RIGHT_STICK_RADIUS);
|
||||
y_ = Classic::RIGHT_STICK_CENTER_Y + (u8)(y * Classic::RIGHT_STICK_RADIUS);
|
||||
|
||||
ccdata->rx1 = x_;
|
||||
ccdata->rx2 = x_ >> 1;
|
||||
@ -117,8 +117,8 @@ void Classic::GetState(u8* const data)
|
||||
u8 lt, rt;
|
||||
m_triggers->GetState(&ccdata->bt, classic_trigger_bitmasks, trigs);
|
||||
|
||||
lt = trigs[0] * Classic::LEFT_TRIGGER_RANGE;
|
||||
rt = trigs[1] * Classic::RIGHT_TRIGGER_RANGE;
|
||||
lt = (u8)(trigs[0] * Classic::LEFT_TRIGGER_RANGE);
|
||||
rt = (u8)(trigs[1] * Classic::RIGHT_TRIGGER_RANGE);
|
||||
|
||||
ccdata->lt1 = lt;
|
||||
ccdata->lt2 = lt >> 3;
|
||||
|
@ -63,8 +63,8 @@ void Drums::GetState(u8* const data)
|
||||
double x, y;
|
||||
m_stick->GetState(&x, &y);
|
||||
|
||||
ddata->sx = (x * 0x1F) + 0x20;
|
||||
ddata->sy = (y * 0x1F) + 0x20;
|
||||
ddata->sx = (u8)(x * 0x1F) + 0x20;
|
||||
ddata->sy = (u8)(y * 0x1F) + 0x20;
|
||||
}
|
||||
|
||||
// TODO: softness maybe
|
||||
|
@ -76,8 +76,8 @@ void Guitar::GetState(u8* const data)
|
||||
double x, y;
|
||||
m_stick->GetState(&x, &y);
|
||||
|
||||
gdata->sx = (x * 0x1F) + 0x20;
|
||||
gdata->sy = (y * 0x1F) + 0x20;
|
||||
gdata->sx = (u8)(x * 0x1F) + 0x20;
|
||||
gdata->sy = (u8)(y * 0x1F) + 0x20;
|
||||
}
|
||||
|
||||
// TODO: touch bar, probably not
|
||||
@ -86,7 +86,7 @@ void Guitar::GetState(u8* const data)
|
||||
// whammy bar
|
||||
double whammy;
|
||||
m_whammy->GetState(&whammy);
|
||||
gdata->whammy = whammy * 0x1F;
|
||||
gdata->whammy = (u8)(whammy * 0x1F);
|
||||
|
||||
// buttons
|
||||
m_buttons->GetState(&gdata->bt, guitar_button_bitmasks);
|
||||
|
@ -65,8 +65,8 @@ void Turntable::GetState(u8* const data)
|
||||
double x, y;
|
||||
m_stick->GetState(&x, &y);
|
||||
|
||||
ttdata->sx = (x * 0x1F) + 0x20;
|
||||
ttdata->sy = (y * 0x1F) + 0x20;
|
||||
ttdata->sx = (u8)(x * 0x1F) + 0x20;
|
||||
ttdata->sy = (u8)(y * 0x1F) + 0x20;
|
||||
}
|
||||
|
||||
// left table
|
||||
@ -75,7 +75,7 @@ void Turntable::GetState(u8* const data)
|
||||
s8 tt_;
|
||||
m_left_table->GetState(&tt);
|
||||
|
||||
tt_ = tt * 0x1F;
|
||||
tt_ = (s8)(tt * 0x1F);
|
||||
|
||||
ttdata->ltable1 = tt_;
|
||||
ttdata->ltable2 = tt_ >> 5;
|
||||
@ -87,7 +87,7 @@ void Turntable::GetState(u8* const data)
|
||||
s8 tt_;
|
||||
m_right_table->GetState(&tt);
|
||||
|
||||
tt_ = tt * 0x1F;
|
||||
tt_ = (s8)(tt * 0x1F);
|
||||
|
||||
ttdata->rtable1 = tt_;
|
||||
ttdata->rtable2 = tt_ >> 1;
|
||||
@ -101,7 +101,7 @@ void Turntable::GetState(u8* const data)
|
||||
u8 dial_;
|
||||
m_effect_dial->GetState(&dial);
|
||||
|
||||
dial_ = dial * 0x0F;
|
||||
dial_ = (u8)(dial * 0x0F);
|
||||
|
||||
ttdata->dial1 = dial_;
|
||||
ttdata->dial2 = dial_ >> 3;
|
||||
@ -112,7 +112,7 @@ void Turntable::GetState(u8* const data)
|
||||
double cfs;
|
||||
m_crossfade->GetState(&cfs);
|
||||
|
||||
ttdata->slider = (cfs * 0x07) + 0x08;
|
||||
ttdata->slider = (u8)(cfs * 0x07) + 0x08;
|
||||
}
|
||||
|
||||
// buttons
|
||||
|
Loading…
Reference in New Issue
Block a user