Warning fixes

This commit is contained in:
Connor McLaughlin
2021-06-26 15:05:21 +10:00
parent 1a18e3ceb8
commit 06b009f361
10 changed files with 25 additions and 29 deletions

View File

@ -142,12 +142,13 @@ ControllerInterface::Backend ControllerInterface::GetDefaultBackend()
{
#ifdef WITH_SDL2
return Backend::SDL;
#endif
#else
#ifdef WIN32
return Backend::XInput;
#else
return Backend::None;
#endif
#endif
}
#ifdef WITH_SDL2

View File

@ -654,7 +654,7 @@ static void DoCheatsMenu()
CheatList* cl = System::GetCheatList();
if (!cl)
{
if (!s_host_interface->LoadCheatListFromDatabase() || !(cl = System::GetCheatList()))
if (!s_host_interface->LoadCheatListFromDatabase() || ((cl = System::GetCheatList()) == nullptr))
{
s_host_interface->AddFormattedOSDMessage(10.0f, "No cheats found for %s.", System::GetRunningTitle().c_str());
ReturnToMainWindow();
@ -2057,8 +2057,6 @@ void DrawSettingsWindow()
#ifdef WIN32
case GPURenderer::HardwareD3D11:
{
// TODO: FIXME
bool use_blit_swap_chain = false;
settings_changed |= ToggleButtonForNonSetting(
"Use Blit Swap Chain",
"Uses a blit presentation model instead of flipping. This may be needed on some systems.", "Display",
@ -3064,8 +3062,6 @@ void DrawGameListWindow()
if (BeginFullscreenColumnWindow(0.0f, 450.0f, "game_list_info", ImVec4(0.11f, 0.15f, 0.17f, 1.00f)))
{
const ImGuiWindow* window = ImGui::GetCurrentWindow();
ImGui::SetCursorPos(LayoutScale(ImVec2(50.0f, 50.0f)));
ImGui::Image(selected_entry ? GetGameListCover(selected_entry)->GetHandle() :
GetTextureForGameListEntryType(GameListEntryType::Count)->GetHandle(),
@ -4534,7 +4530,6 @@ void DrawLeaderboardsWindow()
float left = bb.Min.x + padding + image_height + spacing;
float right = bb.Max.x - padding;
float top = bb.Min.y + padding;
ImDrawList* dl = ImGui::GetWindowDrawList();
SmallString text;
ImVec2 text_size;

View File

@ -174,10 +174,10 @@ bool GameList::GetGameListEntry(const std::string& path, GameListEntry* entry)
entry->publisher = std::move(dbentry.publisher);
entry->developer = std::move(dbentry.developer);
entry->release_date = dbentry.release_date;
entry->min_players = dbentry.min_players;
entry->max_players = dbentry.max_players;
entry->min_blocks = dbentry.min_blocks;
entry->max_blocks = dbentry.max_blocks;
entry->min_players = static_cast<u8>(dbentry.min_players);
entry->max_players = static_cast<u8>(dbentry.max_players);
entry->min_blocks = static_cast<u8>(dbentry.min_blocks);
entry->max_blocks = static_cast<u8>(dbentry.max_blocks);
entry->supported_controllers = dbentry.supported_controllers_mask;
}

View File

@ -373,21 +373,21 @@ bool SDLControllerInterface::HandleJoystickAxisEvent(const SDL_JoyAxisEvent* eve
if (value > 0.0f)
{
const AxisCallback& cb = it->axis_mapping[event->axis][AxisSide::Positive];
if (cb)
const AxisCallback& hcb = it->axis_mapping[event->axis][AxisSide::Positive];
if (hcb)
{
// Expand 0..1 - -1..1
cb(value * 2.0f - 1.0f);
hcb(value * 2.0f - 1.0f);
processed = true;
}
}
else if (value < 0.0f)
{
const AxisCallback& cb = it->axis_mapping[event->axis][AxisSide::Negative];
if (cb)
const AxisCallback& hcb = it->axis_mapping[event->axis][AxisSide::Negative];
if (hcb)
{
// Expand 0..-1 - -1..1
cb(value * -2.0f - 1.0f);
hcb(value * -2.0f - 1.0f);
processed = true;
}
}
@ -756,7 +756,7 @@ void SDLControllerInterface::SetControllerRumbleStrength(int controller_index, c
if (it->use_game_controller_rumble)
{
const u16 large = static_cast<u16>(strengths[0] * 65535.0f);
const u16 small = static_cast<u32>(strengths[1] * 65535.0f);
const u16 small = static_cast<u16>(strengths[1] * 65535.0f);
SDL_GameControllerRumble(static_cast<SDL_GameController*>(it->game_controller), large, small, DURATION);
return;
}
@ -769,8 +769,8 @@ void SDLControllerInterface::SetControllerRumbleStrength(int controller_index, c
{
SDL_HapticEffect ef;
ef.type = SDL_HAPTIC_LEFTRIGHT;
ef.leftright.large_magnitude = static_cast<u32>(strengths[0] * 65535.0f);
ef.leftright.small_magnitude = static_cast<u32>(strengths[1] * 65535.0f);
ef.leftright.large_magnitude = static_cast<u16>(strengths[0] * 65535.0f);
ef.leftright.small_magnitude = static_cast<u16>(strengths[1] * 65535.0f);
ef.leftright.length = DURATION;
SDL_HapticUpdateEffect(haptic, it->haptic_left_right_effect, &ef);
SDL_HapticRunEffect(haptic, it->haptic_left_right_effect, SDL_HAPTIC_INFINITY);