summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/audio_core/CMakeLists.txt1
-rw-r--r--src/common/CMakeLists.txt6
-rw-r--r--src/common/bit_field.h15
-rw-r--r--src/core/CMakeLists.txt1
-rw-r--r--src/core/file_sys/program_metadata.cpp2
-rw-r--r--src/core/hid/emulated_controller.cpp22
-rw-r--r--src/core/hle/kernel/svc.cpp4
-rw-r--r--src/core/hle/service/am/applets/applets.h2
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp20
-rw-r--r--src/input_common/CMakeLists.txt1
-rw-r--r--src/input_common/drivers/sdl_driver.cpp4
-rw-r--r--src/input_common/input_poller.cpp18
-rw-r--r--src/shader_recompiler/CMakeLists.txt1
14 files changed, 57 insertions, 41 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71853eaad..cfd80886c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -76,6 +76,7 @@ if (MSVC)
76 /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? 76 /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
77 /we4555 # Expression has no effect; expected expression with side-effect 77 /we4555 # Expression has no effect; expected expression with side-effect
78 /we4715 # 'function': not all control paths return a value 78 /we4715 # 'function': not all control paths return a value
79 /we4826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
79 /we4834 # Discarding return value of function with 'nodiscard' attribute 80 /we4834 # Discarding return value of function with 'nodiscard' attribute
80 /we5038 # data member 'member1' will be initialized after data member 'member2' 81 /we5038 # data member 'member1' will be initialized after data member 'member2'
81 /we5245 # 'function': unreferenced function with internal linkage has been removed 82 /we5245 # 'function': unreferenced function with internal linkage has been removed
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index 01b4ffd88..0a1f3bf18 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -206,6 +206,7 @@ if (MSVC)
206 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data 206 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
207 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch 207 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
208 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data 208 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
209 /we4800 # Implicit conversion from 'type' to bool. Possible information loss
209 ) 210 )
210else() 211else()
211 target_compile_options(audio_core PRIVATE 212 target_compile_options(audio_core PRIVATE
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 6da547a3f..043f27fb1 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -157,6 +157,12 @@ if (MSVC)
157 target_compile_options(common PRIVATE 157 target_compile_options(common PRIVATE
158 /W4 158 /W4
159 /WX 159 /WX
160
161 /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
162 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
163 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
164 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
165 /we4800 # Implicit conversion from 'type' to bool. Possible information loss
160 ) 166 )
161else() 167else()
162 target_compile_options(common PRIVATE 168 target_compile_options(common PRIVATE
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 7e1df62b1..e4e58ea45 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -141,10 +141,6 @@ public:
141 constexpr BitField(BitField&&) noexcept = default; 141 constexpr BitField(BitField&&) noexcept = default;
142 constexpr BitField& operator=(BitField&&) noexcept = default; 142 constexpr BitField& operator=(BitField&&) noexcept = default;
143 143
144 [[nodiscard]] constexpr operator T() const {
145 return Value();
146 }
147
148 constexpr void Assign(const T& value) { 144 constexpr void Assign(const T& value) {
149#ifdef _MSC_VER 145#ifdef _MSC_VER
150 storage = static_cast<StorageType>((storage & ~mask) | FormatValue(value)); 146 storage = static_cast<StorageType>((storage & ~mask) | FormatValue(value));
@@ -162,6 +158,17 @@ public:
162 return ExtractValue(storage); 158 return ExtractValue(storage);
163 } 159 }
164 160
161 template <typename ConvertedToType>
162 [[nodiscard]] constexpr ConvertedToType As() const {
163 static_assert(!std::is_same_v<T, ConvertedToType>,
164 "Unnecessary cast. Use Value() instead.");
165 return static_cast<ConvertedToType>(Value());
166 }
167
168 [[nodiscard]] constexpr operator T() const {
169 return Value();
170 }
171
165 [[nodiscard]] constexpr explicit operator bool() const { 172 [[nodiscard]] constexpr explicit operator bool() const {
166 return Value() != 0; 173 return Value() != 0;
167 } 174 }
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 72da9cb56..113e663b5 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -774,6 +774,7 @@ if (MSVC)
774 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data 774 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
775 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch 775 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
776 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data 776 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
777 /we4800 # Implicit conversion from 'type' to bool. Possible information loss
777 ) 778 )
778else() 779else()
779 target_compile_options(core PRIVATE 780 target_compile_options(core PRIVATE
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp
index 08d489eab..f00479bd3 100644
--- a/src/core/file_sys/program_metadata.cpp
+++ b/src/core/file_sys/program_metadata.cpp
@@ -127,7 +127,7 @@ void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address
127} 127}
128 128
129bool ProgramMetadata::Is64BitProgram() const { 129bool ProgramMetadata::Is64BitProgram() const {
130 return npdm_header.has_64_bit_instructions; 130 return npdm_header.has_64_bit_instructions.As<bool>();
131} 131}
132 132
133ProgramAddressSpaceType ProgramMetadata::GetAddressSpaceType() const { 133ProgramAddressSpaceType ProgramMetadata::GetAddressSpaceType() const {
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 025f1c78e..57eff72fe 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -1158,27 +1158,27 @@ bool EmulatedController::IsControllerSupported(bool use_temporary_value) const {
1158 const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type; 1158 const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
1159 switch (type) { 1159 switch (type) {
1160 case NpadStyleIndex::ProController: 1160 case NpadStyleIndex::ProController:
1161 return supported_style_tag.fullkey; 1161 return supported_style_tag.fullkey.As<bool>();
1162 case NpadStyleIndex::Handheld: 1162 case NpadStyleIndex::Handheld:
1163 return supported_style_tag.handheld; 1163 return supported_style_tag.handheld.As<bool>();
1164 case NpadStyleIndex::JoyconDual: 1164 case NpadStyleIndex::JoyconDual:
1165 return supported_style_tag.joycon_dual; 1165 return supported_style_tag.joycon_dual.As<bool>();
1166 case NpadStyleIndex::JoyconLeft: 1166 case NpadStyleIndex::JoyconLeft:
1167 return supported_style_tag.joycon_left; 1167 return supported_style_tag.joycon_left.As<bool>();
1168 case NpadStyleIndex::JoyconRight: 1168 case NpadStyleIndex::JoyconRight:
1169 return supported_style_tag.joycon_right; 1169 return supported_style_tag.joycon_right.As<bool>();
1170 case NpadStyleIndex::GameCube: 1170 case NpadStyleIndex::GameCube:
1171 return supported_style_tag.gamecube; 1171 return supported_style_tag.gamecube.As<bool>();
1172 case NpadStyleIndex::Pokeball: 1172 case NpadStyleIndex::Pokeball:
1173 return supported_style_tag.palma; 1173 return supported_style_tag.palma.As<bool>();
1174 case NpadStyleIndex::NES: 1174 case NpadStyleIndex::NES:
1175 return supported_style_tag.lark; 1175 return supported_style_tag.lark.As<bool>();
1176 case NpadStyleIndex::SNES: 1176 case NpadStyleIndex::SNES:
1177 return supported_style_tag.lucia; 1177 return supported_style_tag.lucia.As<bool>();
1178 case NpadStyleIndex::N64: 1178 case NpadStyleIndex::N64:
1179 return supported_style_tag.lagoon; 1179 return supported_style_tag.lagoon.As<bool>();
1180 case NpadStyleIndex::SegaGenesis: 1180 case NpadStyleIndex::SegaGenesis:
1181 return supported_style_tag.lager; 1181 return supported_style_tag.lager.As<bool>();
1182 default: 1182 default:
1183 return false; 1183 return false;
1184 } 1184 }
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index b07ae3f02..4aca5b27d 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -751,8 +751,8 @@ static void Break(Core::System& system, u32 reason, u64 info1, u64 info2) {
751 } 751 }
752 752
753 system.GetReporter().SaveSvcBreakReport( 753 system.GetReporter().SaveSvcBreakReport(
754 static_cast<u32>(break_reason.break_type.Value()), break_reason.signal_debugger, info1, 754 static_cast<u32>(break_reason.break_type.Value()), break_reason.signal_debugger.As<bool>(),
755 info2, has_dumped_buffer ? std::make_optional(debug_buffer) : std::nullopt); 755 info1, info2, has_dumped_buffer ? std::make_optional(debug_buffer) : std::nullopt);
756 756
757 if (!break_reason.signal_debugger) { 757 if (!break_reason.signal_debugger) {
758 LOG_CRITICAL( 758 LOG_CRITICAL(
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index e78a57657..12c6a5b1a 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -164,7 +164,7 @@ protected:
164 u32_le size; 164 u32_le size;
165 u32_le library_version; 165 u32_le library_version;
166 u32_le theme_color; 166 u32_le theme_color;
167 u8 play_startup_sound; 167 bool play_startup_sound;
168 u64_le system_tick; 168 u64_le system_tick;
169 }; 169 };
170 static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); 170 static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size.");
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index ba8a1f786..3b26e96de 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -1502,25 +1502,25 @@ bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller
1502 Core::HID::NpadStyleTag style = GetSupportedStyleSet(); 1502 Core::HID::NpadStyleTag style = GetSupportedStyleSet();
1503 switch (controller) { 1503 switch (controller) {
1504 case Core::HID::NpadStyleIndex::ProController: 1504 case Core::HID::NpadStyleIndex::ProController:
1505 return style.fullkey; 1505 return style.fullkey.As<bool>();
1506 case Core::HID::NpadStyleIndex::JoyconDual: 1506 case Core::HID::NpadStyleIndex::JoyconDual:
1507 return style.joycon_dual; 1507 return style.joycon_dual.As<bool>();
1508 case Core::HID::NpadStyleIndex::JoyconLeft: 1508 case Core::HID::NpadStyleIndex::JoyconLeft:
1509 return style.joycon_left; 1509 return style.joycon_left.As<bool>();
1510 case Core::HID::NpadStyleIndex::JoyconRight: 1510 case Core::HID::NpadStyleIndex::JoyconRight:
1511 return style.joycon_right; 1511 return style.joycon_right.As<bool>();
1512 case Core::HID::NpadStyleIndex::GameCube: 1512 case Core::HID::NpadStyleIndex::GameCube:
1513 return style.gamecube; 1513 return style.gamecube.As<bool>();
1514 case Core::HID::NpadStyleIndex::Pokeball: 1514 case Core::HID::NpadStyleIndex::Pokeball:
1515 return style.palma; 1515 return style.palma.As<bool>();
1516 case Core::HID::NpadStyleIndex::NES: 1516 case Core::HID::NpadStyleIndex::NES:
1517 return style.lark; 1517 return style.lark.As<bool>();
1518 case Core::HID::NpadStyleIndex::SNES: 1518 case Core::HID::NpadStyleIndex::SNES:
1519 return style.lucia; 1519 return style.lucia.As<bool>();
1520 case Core::HID::NpadStyleIndex::N64: 1520 case Core::HID::NpadStyleIndex::N64:
1521 return style.lagoon; 1521 return style.lagoon.As<bool>();
1522 case Core::HID::NpadStyleIndex::SegaGenesis: 1522 case Core::HID::NpadStyleIndex::SegaGenesis:
1523 return style.lager; 1523 return style.lager.As<bool>();
1524 default: 1524 default:
1525 return false; 1525 return false;
1526 } 1526 }
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index 7935ac655..d2730bdc1 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -45,6 +45,7 @@ if (MSVC)
45 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data 45 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
46 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch 46 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
47 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data 47 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
48 /we4800 # Implicit conversion from 'type' to bool. Possible information loss
48 ) 49 )
49else() 50else()
50 target_compile_options(input_common PRIVATE 51 target_compile_options(input_common PRIVATE
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index b72e4b397..c175a8853 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -40,8 +40,8 @@ public:
40 void EnableMotion() { 40 void EnableMotion() {
41 if (sdl_controller) { 41 if (sdl_controller) {
42 SDL_GameController* controller = sdl_controller.get(); 42 SDL_GameController* controller = sdl_controller.get();
43 has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL); 43 has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) == SDL_TRUE;
44 has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO); 44 has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) == SDL_TRUE;
45 if (has_accel) { 45 if (has_accel) {
46 SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); 46 SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE);
47 } 47 }
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp
index ca33fb4eb..ccc3076ca 100644
--- a/src/input_common/input_poller.cpp
+++ b/src/input_common/input_poller.cpp
@@ -797,8 +797,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateButtonDevice(
797 797
798 const auto button_id = params.Get("button", 0); 798 const auto button_id = params.Get("button", 0);
799 const auto keyboard_key = params.Get("code", 0); 799 const auto keyboard_key = params.Get("code", 0);
800 const auto toggle = params.Get("toggle", false); 800 const auto toggle = params.Get("toggle", false) != 0;
801 const auto inverted = params.Get("inverted", false); 801 const auto inverted = params.Get("inverted", false) != 0;
802 input_engine->PreSetController(identifier); 802 input_engine->PreSetController(identifier);
803 input_engine->PreSetButton(identifier, button_id); 803 input_engine->PreSetButton(identifier, button_id);
804 input_engine->PreSetButton(identifier, keyboard_key); 804 input_engine->PreSetButton(identifier, keyboard_key);
@@ -820,8 +820,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateHatButtonDevice(
820 820
821 const auto button_id = params.Get("hat", 0); 821 const auto button_id = params.Get("hat", 0);
822 const auto direction = input_engine->GetHatButtonId(params.Get("direction", "")); 822 const auto direction = input_engine->GetHatButtonId(params.Get("direction", ""));
823 const auto toggle = params.Get("toggle", false); 823 const auto toggle = params.Get("toggle", false) != 0;
824 const auto inverted = params.Get("inverted", false); 824 const auto inverted = params.Get("inverted", false) != 0;
825 825
826 input_engine->PreSetController(identifier); 826 input_engine->PreSetController(identifier);
827 input_engine->PreSetHatButton(identifier, button_id); 827 input_engine->PreSetHatButton(identifier, button_id);
@@ -879,7 +879,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice(
879 .threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f), 879 .threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f),
880 .offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f), 880 .offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f),
881 .inverted = params.Get("invert", "+") == "-", 881 .inverted = params.Get("invert", "+") == "-",
882 .toggle = static_cast<bool>(params.Get("toggle", false)), 882 .toggle = params.Get("toggle", false) != 0,
883 }; 883 };
884 input_engine->PreSetController(identifier); 884 input_engine->PreSetController(identifier);
885 input_engine->PreSetAxis(identifier, axis); 885 input_engine->PreSetAxis(identifier, axis);
@@ -895,8 +895,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTriggerDevice(
895 }; 895 };
896 896
897 const auto button = params.Get("button", 0); 897 const auto button = params.Get("button", 0);
898 const auto toggle = params.Get("toggle", false); 898 const auto toggle = params.Get("toggle", false) != 0;
899 const auto inverted = params.Get("inverted", false); 899 const auto inverted = params.Get("inverted", false) != 0;
900 900
901 const auto axis = params.Get("axis", 0); 901 const auto axis = params.Get("axis", 0);
902 const Common::Input::AnalogProperties properties = { 902 const Common::Input::AnalogProperties properties = {
@@ -926,8 +926,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice(
926 }; 926 };
927 927
928 const auto button = params.Get("button", 0); 928 const auto button = params.Get("button", 0);
929 const auto toggle = params.Get("toggle", false); 929 const auto toggle = params.Get("toggle", false) != 0;
930 const auto inverted = params.Get("inverted", false); 930 const auto inverted = params.Get("inverted", false) != 0;
931 931
932 const auto axis_x = params.Get("axis_x", 0); 932 const auto axis_x = params.Get("axis_x", 0);
933 const Common::Input::AnalogProperties properties_x = { 933 const Common::Input::AnalogProperties properties_x = {
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt
index cbc1daf77..967da0791 100644
--- a/src/shader_recompiler/CMakeLists.txt
+++ b/src/shader_recompiler/CMakeLists.txt
@@ -248,7 +248,6 @@ if (MSVC)
248 /we4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch 248 /we4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
249 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data 249 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
250 /we4800 # Implicit conversion from 'type' to bool. Possible information loss 250 /we4800 # Implicit conversion from 'type' to bool. Possible information loss
251 /we4826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
252 ) 251 )
253else() 252else()
254 target_compile_options(shader_recompiler PRIVATE 253 target_compile_options(shader_recompiler PRIVATE