Chore: Enable warnings as errors on MSVC (#6456)

* tests: add Sanity test for SplitFilename83

fix test

fix test

* disable `C4715:not all control paths return a value` for nihstro includes

nihstro: no warn

* Chore: Enable warnings as errors on msvc + fix warnings

fixes

some more warnings

clang-format

* more fixes

* Externals: Add target_compile_options `/W0` nihstro-headers and ...

Revert "disable `C4715:not all control paths return a value` for nihstro includes"
This reverts commit 606d79b55d3044b744fb835025b8eb0f4ea5b757.

* src\citra\config.cpp: ReadSetting: simplify type casting

* settings.cpp: Get*Name: remove superflous logs
This commit is contained in:
SachinVin 2023-05-02 01:08:58 +05:30 committed by GitHub
parent 055a58f01e
commit 41f13456c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 397 additions and 294 deletions

View file

@ -40,7 +40,7 @@ std::vector<HLE::Applets::MiiData> LoadMiis() {
std::array<u8, sizeof(mii)> mii_raw;
file->Read(saved_miis_offset, sizeof(mii), mii_raw.data());
std::memcpy(&mii, mii_raw.data(), sizeof(mii));
if (mii.mii_id != 0) {
if (mii.mii_id != 0u) {
miis.push_back(mii);
}
saved_miis_offset += sizeof(mii);

View file

@ -31,8 +31,8 @@ struct MiiSelectorData {
class MiiSelector {
public:
virtual ~MiiSelector() = default;
virtual void Setup(const MiiSelectorConfig& config) {
this->config = MiiSelectorConfig(config);
virtual void Setup(const MiiSelectorConfig& config_) {
config = MiiSelectorConfig(config_);
}
const MiiSelectorData& ReceiveData() const {

View file

@ -144,8 +144,8 @@ const KeyboardData& SoftwareKeyboard::ReceiveData() {
return data;
}
void DefaultKeyboard::Execute(const Frontend::KeyboardConfig& config) {
SoftwareKeyboard::Execute(config);
void DefaultKeyboard::Execute(const Frontend::KeyboardConfig& config_) {
SoftwareKeyboard::Execute(config_);
auto cfg = Service::CFG::GetModule(Core::System::GetInstance());
ASSERT_MSG(cfg, "CFG Module missing!");

View file

@ -85,8 +85,8 @@ public:
/**
* Executes the software keyboard, configured with the given parameters.
*/
virtual void Execute(const KeyboardConfig& config) {
this->config = config;
virtual void Execute(const KeyboardConfig& config_) {
config = config_;
}
/**

View file

@ -173,9 +173,13 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
bool is_portrait_mode) {
Layout::FramebufferLayout layout;
const auto layout_option = Settings::values.layout_option;
const auto min_size = Layout::GetMinimumSizeFromLayout(
layout_option.GetValue(), Settings::values.upright_screen.GetValue());
// If in portrait mode, only the MobilePortrait option really makes sense
const Settings::LayoutOption layout_option = is_portrait_mode
? Settings::LayoutOption::MobilePortrait
: Settings::values.layout_option.GetValue();
const auto min_size =
Layout::GetMinimumSizeFromLayout(layout_option, Settings::values.upright_screen.GetValue());
if (Settings::values.custom_layout.GetValue() == true) {
layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue());
@ -183,11 +187,6 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
width = std::max(width, min_size.first);
height = std::max(height, min_size.second);
// If in portrait mode, only the MobilePortrait option really makes sense
const Settings::LayoutOption layout_option =
is_portrait_mode ? Settings::LayoutOption::MobilePortrait
: Settings::values.layout_option.GetValue();
switch (layout_option) {
case Settings::LayoutOption::SingleScreen:
layout =

View file

@ -281,7 +281,8 @@ private:
* For the request to be honored, EmuWindow implementations will usually reimplement this
* function.
*/
virtual void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) {
virtual void OnMinimalClientAreaChangeRequest(
[[maybe_unused]] std::pair<u32, u32> minimal_size) {
// By default, ignore this request and do nothing.
}

View file

@ -421,28 +421,32 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
if (Settings::values.upright_screen.GetValue()) {
if (Settings::values.swap_screen.GetValue()) {
width = Core::kScreenBottomHeight * res_scale;
height = (Core::kScreenBottomWidth +
Core::kScreenTopWidth /
Settings::values.large_screen_proportion.GetValue()) *
res_scale;
height =
(Core::kScreenBottomWidth +
static_cast<int>(Core::kScreenTopWidth /
Settings::values.large_screen_proportion.GetValue())) *
res_scale;
} else {
width = Core::kScreenTopHeight * res_scale;
height = (Core::kScreenTopWidth +
Core::kScreenBottomWidth /
Settings::values.large_screen_proportion.GetValue()) *
res_scale;
height =
(Core::kScreenTopWidth +
static_cast<int>(Core::kScreenBottomWidth /
Settings::values.large_screen_proportion.GetValue())) *
res_scale;
}
} else {
if (Settings::values.swap_screen.GetValue()) {
width = (Core::kScreenBottomWidth +
Core::kScreenTopWidth /
Settings::values.large_screen_proportion.GetValue()) *
static_cast<int>(
Settings::values.large_screen_proportion.GetValue())) *
res_scale;
height = Core::kScreenBottomHeight * res_scale;
} else {
width = (Core::kScreenTopWidth +
Core::kScreenBottomWidth /
Settings::values.large_screen_proportion.GetValue()) *
static_cast<int>(
Settings::values.large_screen_proportion.GetValue())) *
res_scale;
height = Core::kScreenTopHeight * res_scale;
}
@ -470,10 +474,14 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
break;
case Settings::LayoutOption::MobileLandscape:
if (Settings::values.swap_screen.GetValue()) {
width = (Core::kScreenBottomWidth + Core::kScreenTopWidth / 2.25f) * res_scale;
width =
(Core::kScreenBottomWidth + static_cast<int>(Core::kScreenTopWidth / 2.25f)) *
res_scale;
height = Core::kScreenBottomHeight * res_scale;
} else {
width = (Core::kScreenTopWidth + Core::kScreenBottomWidth / 2.25f) * res_scale;
width =
(Core::kScreenTopWidth + static_cast<int>(Core::kScreenBottomWidth / 2.25f)) *
res_scale;
height = Core::kScreenTopHeight * res_scale;
}
layout = MobileLandscapeFrameLayout(
@ -586,7 +594,7 @@ FramebufferLayout GetCardboardSettings(const FramebufferLayout& layout) {
std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption layout,
bool upright_screen) {
unsigned min_width, min_height;
u32 min_width, min_height;
switch (layout) {
case Settings::LayoutOption::SingleScreen:
@ -597,12 +605,12 @@ std::pair<unsigned, unsigned> GetMinimumSizeFromLayout(Settings::LayoutOption la
min_height = Core::kScreenBottomHeight;
break;
case Settings::LayoutOption::LargeScreen:
min_width =
min_width = static_cast<u32>(
Settings::values.swap_screen
? Core::kScreenTopWidth / Settings::values.large_screen_proportion.GetValue() +
Core::kScreenBottomWidth
: Core::kScreenTopWidth + Core::kScreenBottomWidth /
Settings::values.large_screen_proportion.GetValue();
Settings::values.large_screen_proportion.GetValue());
min_height = Core::kScreenBottomHeight;
break;
case Settings::LayoutOption::SideScreen: