mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-04-29 12:05:42 -04:00
GameSettings: Add multitap mode
This commit is contained in:
parent
1d00f96f89
commit
05ac272c3f
@ -885,8 +885,8 @@ const char* Settings::GetMemoryCardTypeDisplayName(MemoryCardType type)
|
|||||||
|
|
||||||
static std::array<const char*, 4> s_multitap_enable_mode_names = {{"Disabled", "Port1Only", "Port2Only", "BothPorts"}};
|
static std::array<const char*, 4> s_multitap_enable_mode_names = {{"Disabled", "Port1Only", "Port2Only", "BothPorts"}};
|
||||||
static std::array<const char*, 4> s_multitap_enable_mode_display_names = {
|
static std::array<const char*, 4> s_multitap_enable_mode_display_names = {
|
||||||
{TRANSLATABLE("MultitapMode", "Disabled"), TRANSLATABLE("MultitapMode", "Enable on Port 1 only"),
|
{TRANSLATABLE("MultitapMode", "Disabled"), TRANSLATABLE("MultitapMode", "Enable on Port 1 Only"),
|
||||||
TRANSLATABLE("MultitapMode", "Enable on Port 2 only"), TRANSLATABLE("MultitapMode", "Enable on Ports 1 and 2")}};
|
TRANSLATABLE("MultitapMode", "Enable on Port 2 Only"), TRANSLATABLE("MultitapMode", "Enable on Ports 1 and 2")}};
|
||||||
|
|
||||||
std::optional<MultitapMode> Settings::ParseMultitapModeName(const char* str)
|
std::optional<MultitapMode> Settings::ParseMultitapModeName(const char* str)
|
||||||
{
|
{
|
||||||
|
@ -152,6 +152,12 @@ void GamePropertiesDialog::setupAdditionalUi()
|
|||||||
qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(static_cast<GPUTextureFilter>(i))));
|
qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(static_cast<GPUTextureFilter>(i))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ui.userMultitapMode->addItem(tr("(unchanged)"));
|
||||||
|
for (u32 i = 0; i < static_cast<u32>(MultitapMode::Count); i++)
|
||||||
|
{
|
||||||
|
m_ui.userMultitapMode->addItem(
|
||||||
|
qApp->translate("MultitapMode", Settings::GetMultitapModeDisplayName(static_cast<MultitapMode>(i))));
|
||||||
|
}
|
||||||
m_ui.userControllerType1->addItem(tr("(unchanged)"));
|
m_ui.userControllerType1->addItem(tr("(unchanged)"));
|
||||||
for (u32 i = 0; i < static_cast<u32>(ControllerType::Count); i++)
|
for (u32 i = 0; i < static_cast<u32>(ControllerType::Count); i++)
|
||||||
{
|
{
|
||||||
@ -409,6 +415,11 @@ void GamePropertiesDialog::populateGameSettings()
|
|||||||
populateBooleanUserSetting(m_ui.userPGXPProjectionPrecision, gs.gpu_pgxp_projection_precision);
|
populateBooleanUserSetting(m_ui.userPGXPProjectionPrecision, gs.gpu_pgxp_projection_precision);
|
||||||
populateBooleanUserSetting(m_ui.userPGXPDepthBuffer, gs.gpu_pgxp_depth_buffer);
|
populateBooleanUserSetting(m_ui.userPGXPDepthBuffer, gs.gpu_pgxp_depth_buffer);
|
||||||
|
|
||||||
|
if (gs.multitap_mode.has_value())
|
||||||
|
{
|
||||||
|
QSignalBlocker sb(m_ui.userMultitapMode);
|
||||||
|
m_ui.userMultitapMode->setCurrentIndex(static_cast<int>(gs.multitap_mode.value()) + 1);
|
||||||
|
}
|
||||||
if (gs.controller_1_type.has_value())
|
if (gs.controller_1_type.has_value())
|
||||||
{
|
{
|
||||||
QSignalBlocker sb(m_ui.userControllerType1);
|
QSignalBlocker sb(m_ui.userControllerType1);
|
||||||
@ -605,6 +616,14 @@ void GamePropertiesDialog::connectUi()
|
|||||||
connectBooleanUserSetting(m_ui.userPGXPProjectionPrecision, &m_game_settings.gpu_pgxp_projection_precision);
|
connectBooleanUserSetting(m_ui.userPGXPProjectionPrecision, &m_game_settings.gpu_pgxp_projection_precision);
|
||||||
connectBooleanUserSetting(m_ui.userPGXPDepthBuffer, &m_game_settings.gpu_pgxp_depth_buffer);
|
connectBooleanUserSetting(m_ui.userPGXPDepthBuffer, &m_game_settings.gpu_pgxp_depth_buffer);
|
||||||
|
|
||||||
|
connect(m_ui.userMultitapMode, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||||
|
if (index <= 0)
|
||||||
|
m_game_settings.multitap_mode.reset();
|
||||||
|
else
|
||||||
|
m_game_settings.multitap_mode = static_cast<MultitapMode>(index - 1);
|
||||||
|
saveGameSettings();
|
||||||
|
});
|
||||||
|
|
||||||
connect(m_ui.userControllerType1, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
connect(m_ui.userControllerType1, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||||
if (index <= 0)
|
if (index <= 0)
|
||||||
m_game_settings.controller_1_type.reset();
|
m_game_settings.controller_1_type.reset();
|
||||||
|
@ -613,36 +613,46 @@
|
|||||||
<string>Controller Settings</string>
|
<string>Controller Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_4">
|
<layout class="QFormLayout" name="formLayout_4">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_15">
|
<widget class="QLabel" name="label_15">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Controller 1 Type:</string>
|
<string>Controller 1 Type:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="userControllerType1"/>
|
<widget class="QComboBox" name="userControllerType1"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_16">
|
<widget class="QLabel" name="label_16">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Controller 2 Type:</string>
|
<string>Controller 2 Type:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="userControllerType2"/>
|
<widget class="QComboBox" name="userControllerType2"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_19">
|
<widget class="QLabel" name="label_19">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Input Profile For Bindings:</string>
|
<string>Input Profile For Bindings:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="userInputProfile"/>
|
<widget class="QComboBox" name="userInputProfile"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_33">
|
||||||
|
<property name="text">
|
||||||
|
<string>Multitap Mode:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="userMultitapMode"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -132,7 +132,7 @@ private:
|
|||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
|
GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
|
||||||
GAME_LIST_CACHE_VERSION = 23
|
GAME_LIST_CACHE_VERSION = 24
|
||||||
};
|
};
|
||||||
|
|
||||||
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;
|
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;
|
||||||
|
@ -128,9 +128,9 @@ bool Entry::LoadFromStream(ByteStream* stream)
|
|||||||
!ReadOptionalFromStream(stream, &gpu_force_ntsc_timings) ||
|
!ReadOptionalFromStream(stream, &gpu_force_ntsc_timings) ||
|
||||||
!ReadOptionalFromStream(stream, &gpu_texture_filter) || !ReadOptionalFromStream(stream, &gpu_widescreen_hack) ||
|
!ReadOptionalFromStream(stream, &gpu_texture_filter) || !ReadOptionalFromStream(stream, &gpu_widescreen_hack) ||
|
||||||
!ReadOptionalFromStream(stream, &gpu_pgxp) || !ReadOptionalFromStream(stream, &gpu_pgxp_projection_precision) ||
|
!ReadOptionalFromStream(stream, &gpu_pgxp) || !ReadOptionalFromStream(stream, &gpu_pgxp_projection_precision) ||
|
||||||
!ReadOptionalFromStream(stream, &gpu_pgxp_depth_buffer) || !ReadOptionalFromStream(stream, &controller_1_type) ||
|
!ReadOptionalFromStream(stream, &gpu_pgxp_depth_buffer) || !ReadOptionalFromStream(stream, &multitap_mode) ||
|
||||||
!ReadOptionalFromStream(stream, &controller_2_type) || !ReadOptionalFromStream(stream, &memory_card_1_type) ||
|
!ReadOptionalFromStream(stream, &controller_1_type) || !ReadOptionalFromStream(stream, &controller_2_type) ||
|
||||||
!ReadOptionalFromStream(stream, &memory_card_2_type) ||
|
!ReadOptionalFromStream(stream, &memory_card_1_type) || !ReadOptionalFromStream(stream, &memory_card_2_type) ||
|
||||||
!ReadStringFromStream(stream, &memory_card_1_shared_path) ||
|
!ReadStringFromStream(stream, &memory_card_1_shared_path) ||
|
||||||
!ReadStringFromStream(stream, &memory_card_2_shared_path) || !ReadStringFromStream(stream, &input_profile_name))
|
!ReadStringFromStream(stream, &memory_card_2_shared_path) || !ReadStringFromStream(stream, &input_profile_name))
|
||||||
{
|
{
|
||||||
@ -178,9 +178,10 @@ bool Entry::SaveToStream(ByteStream* stream) const
|
|||||||
WriteOptionalToStream(stream, gpu_scaled_dithering) && WriteOptionalToStream(stream, gpu_force_ntsc_timings) &&
|
WriteOptionalToStream(stream, gpu_scaled_dithering) && WriteOptionalToStream(stream, gpu_force_ntsc_timings) &&
|
||||||
WriteOptionalToStream(stream, gpu_texture_filter) && WriteOptionalToStream(stream, gpu_widescreen_hack) &&
|
WriteOptionalToStream(stream, gpu_texture_filter) && WriteOptionalToStream(stream, gpu_widescreen_hack) &&
|
||||||
WriteOptionalToStream(stream, gpu_pgxp) && WriteOptionalToStream(stream, gpu_pgxp_projection_precision) &&
|
WriteOptionalToStream(stream, gpu_pgxp) && WriteOptionalToStream(stream, gpu_pgxp_projection_precision) &&
|
||||||
WriteOptionalToStream(stream, gpu_pgxp_depth_buffer) && WriteOptionalToStream(stream, controller_1_type) &&
|
WriteOptionalToStream(stream, gpu_pgxp_depth_buffer) && WriteOptionalToStream(stream, multitap_mode) &&
|
||||||
WriteOptionalToStream(stream, controller_2_type) && WriteOptionalToStream(stream, memory_card_1_type) &&
|
WriteOptionalToStream(stream, controller_1_type) && WriteOptionalToStream(stream, controller_2_type) &&
|
||||||
WriteOptionalToStream(stream, memory_card_2_type) && WriteStringToStream(stream, memory_card_1_shared_path) &&
|
WriteOptionalToStream(stream, memory_card_1_type) && WriteOptionalToStream(stream, memory_card_2_type) &&
|
||||||
|
WriteStringToStream(stream, memory_card_1_shared_path) &&
|
||||||
WriteStringToStream(stream, memory_card_2_shared_path) && WriteStringToStream(stream, input_profile_name);
|
WriteStringToStream(stream, memory_card_2_shared_path) && WriteStringToStream(stream, input_profile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +295,9 @@ static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA
|
|||||||
if (cvalue)
|
if (cvalue)
|
||||||
entry->gpu_pgxp_depth_buffer = StringUtil::FromChars<bool>(cvalue);
|
entry->gpu_pgxp_depth_buffer = StringUtil::FromChars<bool>(cvalue);
|
||||||
|
|
||||||
|
cvalue = ini.GetValue(section, "MultitapMode", nullptr);
|
||||||
|
if (cvalue)
|
||||||
|
entry->multitap_mode = Settings::ParseMultitapModeName(cvalue);
|
||||||
cvalue = ini.GetValue(section, "Controller1Type", nullptr);
|
cvalue = ini.GetValue(section, "Controller1Type", nullptr);
|
||||||
if (cvalue)
|
if (cvalue)
|
||||||
entry->controller_1_type = Settings::ParseControllerTypeName(cvalue);
|
entry->controller_1_type = Settings::ParseControllerTypeName(cvalue);
|
||||||
@ -401,11 +405,8 @@ static void StoreIniSection(const Entry& entry, const char* section, CSimpleIniA
|
|||||||
if (entry.gpu_pgxp_depth_buffer.has_value())
|
if (entry.gpu_pgxp_depth_buffer.has_value())
|
||||||
ini.SetValue(section, "GPUPGXPDepthBuffer", entry.gpu_pgxp_depth_buffer.value() ? "true" : "false");
|
ini.SetValue(section, "GPUPGXPDepthBuffer", entry.gpu_pgxp_depth_buffer.value() ? "true" : "false");
|
||||||
|
|
||||||
if (entry.controller_1_type.has_value())
|
if (entry.multitap_mode.has_value())
|
||||||
ini.SetValue(section, "Controller1Type", Settings::GetControllerTypeName(entry.controller_1_type.value()));
|
ini.SetValue(section, "MultitapMode", Settings::GetMultitapModeName(entry.multitap_mode.value()));
|
||||||
if (entry.controller_2_type.has_value())
|
|
||||||
ini.SetValue(section, "Controller2Type", Settings::GetControllerTypeName(entry.controller_2_type.value()));
|
|
||||||
|
|
||||||
if (entry.controller_1_type.has_value())
|
if (entry.controller_1_type.has_value())
|
||||||
ini.SetValue(section, "Controller1Type", Settings::GetControllerTypeName(entry.controller_1_type.value()));
|
ini.SetValue(section, "Controller1Type", Settings::GetControllerTypeName(entry.controller_1_type.value()));
|
||||||
if (entry.controller_2_type.has_value())
|
if (entry.controller_2_type.has_value())
|
||||||
@ -448,6 +449,7 @@ u32 Entry::GetUserSettingsCount() const
|
|||||||
count += BoolToUInt32(gpu_pgxp.has_value());
|
count += BoolToUInt32(gpu_pgxp.has_value());
|
||||||
count += BoolToUInt32(gpu_pgxp_projection_precision.has_value());
|
count += BoolToUInt32(gpu_pgxp_projection_precision.has_value());
|
||||||
count += BoolToUInt32(gpu_pgxp_depth_buffer.has_value());
|
count += BoolToUInt32(gpu_pgxp_depth_buffer.has_value());
|
||||||
|
count += BoolToUInt32(multitap_mode.has_value());
|
||||||
count += BoolToUInt32(controller_1_type.has_value());
|
count += BoolToUInt32(controller_1_type.has_value());
|
||||||
count += BoolToUInt32(controller_2_type.has_value());
|
count += BoolToUInt32(controller_2_type.has_value());
|
||||||
count += BoolToUInt32(memory_card_1_type.has_value());
|
count += BoolToUInt32(memory_card_1_type.has_value());
|
||||||
@ -600,6 +602,13 @@ static std::optional<std::string> GetEntryValueForKey(const Entry& entry, const
|
|||||||
else
|
else
|
||||||
return entry.gpu_pgxp_depth_buffer.value() ? "true" : "false";
|
return entry.gpu_pgxp_depth_buffer.value() ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
else if (key == "MultitapMode")
|
||||||
|
{
|
||||||
|
if (!entry.multitap_mode.has_value())
|
||||||
|
return std::nullopt;
|
||||||
|
else
|
||||||
|
return Settings::GetMultitapModeName(entry.multitap_mode.value());
|
||||||
|
}
|
||||||
else if (key == "Controller1Type")
|
else if (key == "Controller1Type")
|
||||||
{
|
{
|
||||||
if (!entry.controller_1_type.has_value())
|
if (!entry.controller_1_type.has_value())
|
||||||
@ -817,6 +826,13 @@ static void SetEntryValueForKey(Entry& entry, const std::string_view& key, const
|
|||||||
else
|
else
|
||||||
entry.gpu_pgxp_depth_buffer = StringUtil::FromChars<bool>(value.value()).value_or(false);
|
entry.gpu_pgxp_depth_buffer = StringUtil::FromChars<bool>(value.value()).value_or(false);
|
||||||
}
|
}
|
||||||
|
else if (key == "MultitapMode")
|
||||||
|
{
|
||||||
|
if (!value.has_value())
|
||||||
|
entry.multitap_mode.reset();
|
||||||
|
else
|
||||||
|
entry.multitap_mode = Settings::ParseMultitapModeName(value->c_str());
|
||||||
|
}
|
||||||
else if (key == "Controller1Type")
|
else if (key == "Controller1Type")
|
||||||
{
|
{
|
||||||
if (!value.has_value())
|
if (!value.has_value())
|
||||||
@ -1047,6 +1063,8 @@ void Entry::ApplySettings(bool display_osd_messages) const
|
|||||||
if (gpu_pgxp_depth_buffer.has_value())
|
if (gpu_pgxp_depth_buffer.has_value())
|
||||||
g_settings.gpu_pgxp_depth_buffer = gpu_pgxp_depth_buffer.value();
|
g_settings.gpu_pgxp_depth_buffer = gpu_pgxp_depth_buffer.value();
|
||||||
|
|
||||||
|
if (multitap_mode.has_value())
|
||||||
|
g_settings.multitap_mode = multitap_mode.value();
|
||||||
if (controller_1_type.has_value())
|
if (controller_1_type.has_value())
|
||||||
g_settings.controller_types[0] = controller_1_type.value();
|
g_settings.controller_types[0] = controller_1_type.value();
|
||||||
if (controller_2_type.has_value())
|
if (controller_2_type.has_value())
|
||||||
|
@ -72,6 +72,7 @@ struct Entry
|
|||||||
std::optional<bool> gpu_pgxp;
|
std::optional<bool> gpu_pgxp;
|
||||||
std::optional<bool> gpu_pgxp_projection_precision;
|
std::optional<bool> gpu_pgxp_projection_precision;
|
||||||
std::optional<bool> gpu_pgxp_depth_buffer;
|
std::optional<bool> gpu_pgxp_depth_buffer;
|
||||||
|
std::optional<MultitapMode> multitap_mode;
|
||||||
std::optional<ControllerType> controller_1_type;
|
std::optional<ControllerType> controller_1_type;
|
||||||
std::optional<ControllerType> controller_2_type;
|
std::optional<ControllerType> controller_2_type;
|
||||||
std::optional<MemoryCardType> memory_card_1_type;
|
std::optional<MemoryCardType> memory_card_1_type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user