Misc: Clean up a few warnings

This commit is contained in:
Connor McLaughlin 2022-08-10 13:11:37 +10:00
parent c3da236f92
commit 477bb3d554
5 changed files with 37 additions and 47 deletions

View File

@ -27,11 +27,11 @@ public:
const CDImage::LBA GetLastReadSector() const { return m_buffers[m_buffer_front.load()].lba; }
const SectorBuffer& GetSectorBuffer() const { return m_buffers[m_buffer_front.load()].data; }
const CDImage::SubChannelQ& GetSectorSubQ() const { return m_buffers[m_buffer_front.load()].subq; }
const u32 GetBufferedSectorCount() const { return m_buffer_count.load(); }
const bool HasBufferedSectors() const { return (m_buffer_count.load() > 0); }
const u32 GetReadaheadCount() const { return static_cast<u32>(m_buffers.size()); }
u32 GetBufferedSectorCount() const { return m_buffer_count.load(); }
bool HasBufferedSectors() const { return (m_buffer_count.load() > 0); }
u32 GetReadaheadCount() const { return static_cast<u32>(m_buffers.size()); }
const bool HasMedia() const { return static_cast<bool>(m_media); }
bool HasMedia() const { return static_cast<bool>(m_media); }
const CDImage* GetMedia() const { return m_media.get(); }
const std::string& GetMediaFileName() const { return m_media->GetFileName(); }

View File

@ -138,10 +138,10 @@ public:
virtual bool UpdateImGuiFontTexture() = 0;
const void* GetDisplayTextureHandle() const { return m_display_texture_handle; }
const s32 GetDisplayTopMargin() const { return m_display_top_margin; }
const s32 GetDisplayWidth() const { return m_display_width; }
const s32 GetDisplayHeight() const { return m_display_height; }
const float GetDisplayAspectRatio() const { return m_display_aspect_ratio; }
s32 GetDisplayTopMargin() const { return m_display_top_margin; }
s32 GetDisplayWidth() const { return m_display_width; }
s32 GetDisplayHeight() const { return m_display_height; }
float GetDisplayAspectRatio() const { return m_display_aspect_ratio; }
bool UsesLowerLeftOrigin() const;
void SetDisplayMaxFPS(float max_fps);

View File

@ -144,7 +144,8 @@ bool MainWindow::confirmMessage(const QString& title, const QString& message)
bool MainWindow::shouldHideCursor() const
{
return m_mouse_cursor_hidden || (isRenderingFullscreen() && Host::GetBoolSettingValue("Main", "HideCursorInFullscreen", true));
return m_mouse_cursor_hidden ||
(isRenderingFullscreen() && Host::GetBoolSettingValue("Main", "HideCursorInFullscreen", true));
}
bool MainWindow::createDisplay(bool fullscreen, bool render_to_main)
@ -718,7 +719,7 @@ void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidg
}
QAction* open_memory_cards_action = menu->addAction(tr("Edit Memory Cards..."));
connect(open_memory_cards_action, &QAction::triggered, [this, entry]() {
connect(open_memory_cards_action, &QAction::triggered, [entry]() {
QString paths[2];
for (u32 i = 0; i < 2; i++)
{
@ -769,7 +770,7 @@ void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidg
delete_save_states_action->setEnabled(has_any_states);
if (has_any_states)
{
connect(delete_save_states_action, &QAction::triggered, [this, parent_window, entry] {
connect(delete_save_states_action, &QAction::triggered, [parent_window, entry] {
if (QMessageBox::warning(
parent_window, tr("Confirm Save State Deletion"),
tr("Are you sure you want to delete all save states for %1?\n\nThe saves will not be recoverable.")
@ -809,7 +810,7 @@ void MainWindow::populateLoadStateMenu(const char* game_code, QMenu* menu)
menu->clear();
connect(menu->addAction(tr("Load From File...")), &QAction::triggered, [this]() {
connect(menu->addAction(tr("Load From File...")), &QAction::triggered, []() {
const QString path(
QFileDialog::getOpenFileName(g_main_window, tr("Select Save State File"), QString(), tr("Save States (*.sav)")));
if (path.isEmpty())
@ -836,7 +837,7 @@ void MainWindow::populateLoadStateMenu(const char* game_code, QMenu* menu)
void MainWindow::populateSaveStateMenu(const char* game_code, QMenu* menu)
{
auto add_slot = [this, game_code, menu](const QString& title, const QString& empty_title, bool global, s32 slot) {
auto add_slot = [game_code, menu](const QString& title, const QString& empty_title, bool global, s32 slot) {
std::optional<SaveStateInfo> ssi = System::GetSaveStateInfo(global ? nullptr : game_code, slot);
const QString menu_title =
@ -1281,7 +1282,7 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
{
QAction* action = menu.addAction(tr("Properties..."));
connect(action, &QAction::triggered,
[this, entry]() { SettingsDialog::openGamePropertiesDialog(entry->path, entry->serial, entry->region); });
[entry]() { SettingsDialog::openGamePropertiesDialog(entry->path, entry->serial, entry->region); });
connect(menu.addAction(tr("Open Containing Directory...")), &QAction::triggered, [this, entry]() {
const QFileInfo fi(QString::fromStdString(entry->path));
@ -1299,15 +1300,15 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
menu.addSeparator();
connect(menu.addAction(tr("Default Boot")), &QAction::triggered,
[this, entry]() { g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>(entry->path)); });
[entry]() { g_emu_thread->bootSystem(std::make_shared<SystemBootParameters>(entry->path)); });
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
boot_params->override_fast_boot = true;
g_emu_thread->bootSystem(std::move(boot_params));
});
connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [this, entry]() {
connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [entry]() {
auto boot_params = std::make_shared<SystemBootParameters>(entry->path);
boot_params->override_fast_boot = false;
g_emu_thread->bootSystem(std::move(boot_params));
@ -1533,7 +1534,7 @@ void MainWindow::setupAdditionalUi()
QAction* raAction = raMenu->addAction(QString::fromUtf8(title));
connect(raAction, &QAction::triggered, this,
[id]() { Host::RunOnCPUThread([id]() { Achievements::RAIntegration::ActivateMenuItem(id); }); });
[id = id]() { Host::RunOnCPUThread([id]() { Achievements::RAIntegration::ActivateMenuItem(id); }); });
}
});
m_ui.menuDebug->insertMenu(m_ui.menuCPUExecutionMode->menuAction(), raMenu);
@ -1802,7 +1803,7 @@ void MainWindow::connectSignals()
connect(m_ui.actionPowerOff, &QAction::triggered, this, [this]() { requestShutdown(true, true); });
connect(m_ui.actionPowerOffWithoutSaving, &QAction::triggered, this, [this]() { requestShutdown(false, false); });
connect(m_ui.actionReset, &QAction::triggered, g_emu_thread, &EmuThread::resetSystem);
connect(m_ui.actionPause, &QAction::toggled, [this](bool active) { g_emu_thread->setSystemPaused(active); });
connect(m_ui.actionPause, &QAction::toggled, [](bool active) { g_emu_thread->setSystemPaused(active); });
connect(m_ui.actionScreenshot, &QAction::triggered, g_emu_thread, &EmuThread::saveScreenshot);
connect(m_ui.actionScanForNewGames, &QAction::triggered, this, [this]() { refreshGameList(false); });
connect(m_ui.actionRescanAllGames, &QAction::triggered, this, [this]() { refreshGameList(true); });
@ -1903,7 +1904,7 @@ void MainWindow::connectSignals()
"DumpCPUToVRAMCopies", false);
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionDebugDumpVRAMtoCPUCopies, "Debug",
"DumpVRAMToCPUCopies", false);
connect(m_ui.actionDumpAudio, &QAction::toggled, [this](bool checked) {
connect(m_ui.actionDumpAudio, &QAction::toggled, [](bool checked) {
if (checked)
g_emu_thread->startDumpingAudio();
else
@ -2027,7 +2028,7 @@ void MainWindow::setStyleFromSettings()
// adapted from https://gist.github.com/QuantumCD/6245215
qApp->setStyle(QStyleFactory::create("Fusion"));
const QColor lighterGray(75, 75, 75);
// const QColor lighterGray(75, 75, 75);
const QColor darkGray(53, 53, 53);
const QColor gray(128, 128, 128);
const QColor black(25, 25, 25);

View File

@ -207,7 +207,6 @@ static void DoResume();
static void DoStartFile();
static void DoStartBIOS();
static void DoToggleFastForward();
static void DoToggleSoftwareRenderer();
static void DoShutdown(bool save_state);
static void DoReset();
static void DoChangeDiscFromFile();
@ -268,17 +267,21 @@ static void DrawFloatRangeSetting(const char* title, const char* summary, const
float default_value, float min_value, float max_value, const char* format = "%f",
bool enabled = true, float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
#if 0
static void DrawIntRectSetting(const char* title, const char* summary, const char* section, const char* left_key,
int default_left, const char* top_key, int default_top, const char* right_key,
int default_right, const char* bottom_key, int default_bottom, int min_value,
int max_value, const char* format = "%d", bool enabled = true,
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
ImFont* summary_font = g_medium_font);
#endif
#if 0
static void DrawStringListSetting(const char* title, const char* summary, const char* section, const char* key,
const char* default_value, const char* const* options,
const char* const* option_values, size_t option_count, bool enabled = true,
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
#endif
template<typename DataType, typename SizeType>
static void DrawEnumSetting(const char* title, const char* summary, const char* section, const char* key,
DataType default_value, std::optional<DataType> (*from_string_function)(const char* str),
@ -291,9 +294,11 @@ static void DrawFloatListSetting(const char* title, const char* summary, const c
size_t option_count, bool enabled = true,
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
ImFont* summary_font = g_medium_font);
#if 0
static void DrawFolderSetting(const char* title, const char* section, const char* key, const std::string& runtime_var,
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
ImFont* summary_font = g_medium_font);
#endif
static void PopulateGraphicsAdapterList();
static void PopulateGameListDirectoryCache(SettingsInterface* si);
@ -362,8 +367,6 @@ static void PopulateGameListEntryList();
static HostDisplayTexture* GetTextureForGameListEntryType(GameList::EntryType type);
static HostDisplayTexture* GetGameListCover(const GameList::Entry* entry);
static HostDisplayTexture* GetCoverForCurrentGame();
static std::string GetNotificationImageForGame(const GameList::Entry* entry);
static std::string GetNotificationImageForGame(const std::string& game_path);
// Lazily populated cover images.
static std::unordered_map<std::string, std::string> s_cover_image_map;
@ -728,11 +731,6 @@ void FullscreenUI::DoToggleFastForward()
});
}
void FullscreenUI::DoToggleSoftwareRenderer()
{
Host::RunOnCPUThread(System::ToggleSoftwareRendering);
}
void FullscreenUI::DoChangeDiscFromFile()
{
auto callback = [](const std::string& path) {
@ -1323,6 +1321,7 @@ void FullscreenUI::DrawFloatRangeSetting(const char* title, const char* summary,
ImGui::PopFont();
}
#if 0
void FullscreenUI::DrawIntRectSetting(const char* title, const char* summary, const char* section, const char* left_key,
int default_left, const char* top_key, int default_top, const char* right_key,
int default_right, const char* bottom_key, int default_bottom, int min_value,
@ -1417,7 +1416,9 @@ void FullscreenUI::DrawIntRectSetting(const char* title, const char* summary, co
ImGui::PopStyleVar(3);
ImGui::PopFont();
}
#endif
#if 0
void FullscreenUI::DrawStringListSetting(const char* title, const char* summary, const char* section, const char* key,
const char* default_value, const char* const* options,
const char* const* option_values, size_t option_count, bool enabled,
@ -1484,6 +1485,7 @@ void FullscreenUI::DrawStringListSetting(const char* title, const char* summary,
});
}
}
#endif
template<typename DataType, typename SizeType>
void FullscreenUI::DrawEnumSetting(const char* title, const char* summary, const char* section, const char* key,
@ -1607,6 +1609,7 @@ void FullscreenUI::DrawFloatListSetting(const char* title, const char* summary,
}
}
#if 0
void FullscreenUI::DrawFolderSetting(const char* title, const char* section, const char* key,
const std::string& runtime_var,
float height /* = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT */,
@ -1629,6 +1632,7 @@ void FullscreenUI::DrawFolderSetting(const char* title, const char* section, con
});
}
}
#endif
void FullscreenUI::StartAutomaticBinding(u32 port)
{
@ -4185,12 +4189,14 @@ void FullscreenUI::DrawGameListWindow()
// size
ImGui::Text("Size: %.2f MB", static_cast<float>(selected_entry->total_size) / 1048576.0f);
#if 0
// game settings
const u32 user_setting_count = 0; // FIXME
if (user_setting_count > 0)
ImGui::Text("%u Per-Game Settings Set", user_setting_count);
else
ImGui::TextUnformatted("No Per-Game Settings Set");
#endif
ImGui::PopFont();
}
@ -4269,23 +4275,6 @@ HostDisplayTexture* FullscreenUI::GetCoverForCurrentGame()
return GetGameListCover(entry);
}
std::string FullscreenUI::GetNotificationImageForGame(const GameList::Entry* entry)
{
std::string ret;
if (entry)
ret = GameList::GetCoverImagePathForEntry(entry);
return ret;
}
std::string FullscreenUI::GetNotificationImageForGame(const std::string& game_path)
{
auto lock = GameList::GetLock();
const GameList::Entry* entry = GameList::GetEntryForPath(game_path.c_str());
return entry ? GetNotificationImageForGame(entry) : std::string();
}
//////////////////////////////////////////////////////////////////////////
// Overlays
//////////////////////////////////////////////////////////////////////////

View File

@ -230,7 +230,7 @@ bool CDImageDeviceWin32::Open(const char* filename, Common::Error* error)
index1.index_number = 1;
index1.file_index = 0;
index1.file_sector_size = 2048;
index1.file_offset = static_cast<u64>(track_address) * index1.file_sector_size;
index1.file_offset = static_cast<u64>(track_lba) * index1.file_sector_size;
index1.mode = track_mode;
index1.control.bits = control.bits;
index1.is_pregap = false;