Browse Source

[cmake, common] allow build with -fno-rtti and /GR-, to disable gen of rtti and save some bytes in vtables (#359)

Signed-off-by: lizzie <lizzie@eden-emu.dev>
Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/359
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
feat/new_lang
lizzie 3 days ago
committed by crueter
parent
commit
2082ba7ec7
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 9
      src/CMakeLists.txt
  2. 4
      src/common/settings_common.h
  3. 12
      src/common/settings_setting.h
  4. 6
      src/core/hle/service/cmif_serialization.h
  5. 41
      src/yuzu/configuration/shared_widget.cpp

9
src/CMakeLists.txt

@ -94,6 +94,10 @@ if (MSVC AND NOT CXX_CLANG)
/wd4324 # 'struct_name': structure was padded due to __declspec(align())
/wd4201 # nonstandard extension used : nameless struct/union
/wd4702 # unreachable code (when used with LTO)
$<$<CONFIG:Release>:/GS-> # No stack buffer overflow checks
/Gy # Enable function level linking
/GR- # Disable run time type information
)
if (NOT CXX_CLANG)
@ -108,15 +112,14 @@ if (MSVC AND NOT CXX_CLANG)
add_compile_options(/QIntel-jcc-erratum)
endif()
# /GS- - No stack buffer overflow checks
add_compile_options("$<$<CONFIG:Release>:/GS->")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
else()
if (NOT MSVC)
add_compile_options(
-fwrapv
-fno-rtti # Disable RTTI
-pipe
)
endif()

4
src/common/settings_common.h

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
@ -162,7 +162,7 @@ public:
/**
* @returns A unique identifier for the Setting's internal data type.
*/
[[nodiscard]] virtual std::type_index TypeId() const = 0;
[[nodiscard]] virtual std::string_view TypeId() const = 0;
/**
* Returns true if the Setting's internal data type is an enum.

12
src/common/settings_setting.h

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
@ -220,8 +220,14 @@ public:
*
* @returns the type_index of the setting's type
*/
[[nodiscard]] std::type_index TypeId() const override final {
return std::type_index(typeid(Type));
[[nodiscard]] std::string_view TypeId() const override final {
if constexpr (std::is_same_v<Type, std::string>) {
return "string";
} else if constexpr (std::is_same_v<Type, bool>) {
return "bool";
} else {
return "other";
}
}
[[nodiscard]] constexpr u32 EnumIndex() const override final {

6
src/core/hle/service/cmif_serialization.h

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
@ -444,9 +444,9 @@ void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {
const bool _is_domain = _mgr ? _mgr->IsDomain() : false;
ASSERT_MSG(!_is_domain,
"Non-domain reply used on domain session\n"
"Service={} (type={})\nTIPC={} CmdType={} Cmd=0x{:08X}\n"
"Service={} (TIPC={} CmdType={} Cmd=0x{:08X}\n"
"HasDomainHeader={} DomainHandlers={}\nDesc={}",
t.GetServiceName(), typeid(T).name(), ctx.IsTipc(),
t.GetServiceName(), ctx.IsTipc(),
static_cast<u32>(ctx.GetCommandType()), static_cast<u32>(ctx.GetCommand()),
ctx.HasDomainMessageHeader(), _mgr ? static_cast<u32>(_mgr->DomainHandlerCount()) : 0u,
ctx.Description());

41
src/yuzu/configuration/shared_widget.cpp

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
@ -505,7 +505,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
RequestType request, float multiplier,
Settings::BasicSetting* other_setting, const QString& suffix) {
created = true;
const auto type = setting.TypeId();
const auto type_id = setting.TypeId();
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
@ -514,10 +514,8 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
other_setting = setting.PairedSetting();
}
const bool require_checkbox =
other_setting != nullptr && other_setting->TypeId() == typeid(bool);
if (other_setting != nullptr && other_setting->TypeId() != typeid(bool)) {
const bool require_checkbox = other_setting != nullptr && other_setting->TypeId() == "bool";
if (other_setting != nullptr && other_setting->TypeId() != "bool") {
LOG_WARNING(
Frontend,
"Extra setting \"{}\" specified but is not bool, refusing to create checkbox for it.",
@ -572,16 +570,27 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
}
if (require_checkbox) {
QWidget* lhs =
CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
QWidget* lhs = CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
layout->addWidget(lhs, 1);
} else if (setting.TypeId() != typeid(bool)) {
} else if (type_id != "bool") {
QLabel* qt_label = CreateLabel(label);
layout->addWidget(qt_label, 1);
}
if (setting.TypeId() == typeid(bool)) {
if (type_id == "bool") {
data_component = CreateCheckBox(&setting, label, serializer, restore_func, touch);
} else if (type_id == "string") {
switch (request) {
case RequestType::Default:
case RequestType::LineEdit:
data_component = CreateLineEdit(serializer, restore_func, touch);
break;
case RequestType::ComboBox:
data_component = CreateCombobox(serializer, restore_func, touch);
break;
default:
UNIMPLEMENTED();
}
} else if (setting.IsEnum()) {
if (request == RequestType::RadioGroup) {
data_component = CreateRadioGroup(serializer, restore_func, touch);
@ -629,18 +638,6 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
default:
UNIMPLEMENTED();
}
} else if (type == typeid(std::string)) {
switch (request) {
case RequestType::Default:
case RequestType::LineEdit:
data_component = CreateLineEdit(serializer, restore_func, touch);
break;
case RequestType::ComboBox:
data_component = CreateCombobox(serializer, restore_func, touch);
break;
default:
UNIMPLEMENTED();
}
}
if (data_component == nullptr) {

Loading…
Cancel
Save