Add plugins fallback and change defaults

This commit is contained in:
Milan Nikolic 2024-10-12 09:07:06 +02:00
parent bb9b3ee4f9
commit b4a6f2c3e1
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
4 changed files with 20 additions and 9 deletions

View file

@ -165,6 +165,14 @@ PLUGIN_NAME = {
} }
PLUGIN_DEFAULT = { PLUGIN_DEFAULT = {
M64PLUGIN_NULL: "NULL",
M64PLUGIN_RSP: "mupen64plus-rsp-hle%s" % DLL_EXT,
M64PLUGIN_GFX: "mupen64plus-video-GLideN64%s" % DLL_EXT,
M64PLUGIN_AUDIO: "mupen64plus-audio-sdl%s" % DLL_EXT,
M64PLUGIN_INPUT: "mupen64plus-input-sdl%s" % DLL_EXT
}
PLUGIN_FALLBACK = {
M64PLUGIN_NULL: "NULL", M64PLUGIN_NULL: "NULL",
M64PLUGIN_RSP: "mupen64plus-rsp-hle%s" % DLL_EXT, M64PLUGIN_RSP: "mupen64plus-rsp-hle%s" % DLL_EXT,
M64PLUGIN_GFX: "mupen64plus-video-rice%s" % DLL_EXT, M64PLUGIN_GFX: "mupen64plus-video-rice%s" % DLL_EXT,

View file

@ -123,8 +123,8 @@ class Cheat(QDialog, Ui_CheatDialog):
cd, address, value, choices = cheat cd, address, value, choices = cheat
if choices: if choices:
choices = Choices(self, name, choices) choices = Choices(self, name, choices)
rval = choices.exec_() rval = choices.exec()
if rval == QDialog.Accepted: if rval == QDialog.DialogCode.Accepted:
curr_item = choices.listWidget.currentItem() curr_item = choices.listWidget.currentItem()
value = curr_item.data(Qt.ItemDataRole.UserRole) value = curr_item.data(Qt.ItemDataRole.UserRole)
else: else:

View file

@ -167,17 +167,17 @@ class Settings(QDialog, Ui_Settings):
def get_size_safe(self): def get_size_safe(self):
try: try:
size = self.qset.value("size", SIZE_1X) size = self.qset.value("size", SIZE_2X)
except TypeError: except TypeError:
size = SIZE_1X size = SIZE_2X
if not type(size) == tuple: if not type(size) == tuple:
size = SIZE_1X size = SIZE_2X
if len(size) != 2: if len(size) != 2:
size = SIZE_1X size = SIZE_2X
if type(size[0]) != int or type(size[1]) != int: if type(size[0]) != int or type(size[1]) != int:
size = SIZE_1X size = SIZE_2X
if size[0] <= 0 or size[1] <= 0: if size[0] <= 0 or size[1] <= 0:
size = SIZE_1X size = SIZE_2X
return size return size
def get_parameter_help_safe(self, parameter): def get_parameter_help_safe(self, parameter):
@ -293,6 +293,10 @@ class Settings(QDialog, Ui_Settings):
current = self.qset.value("Plugins/%s" % ( current = self.qset.value("Plugins/%s" % (
PLUGIN_NAME[plugin_type]), PLUGIN_DEFAULT[plugin_type]) PLUGIN_NAME[plugin_type]), PLUGIN_DEFAULT[plugin_type])
index = combo.findText(current) index = combo.findText(current)
if index == -1:
current = self.qset.value("Plugins/%s" % (
PLUGIN_NAME[plugin_type]), PLUGIN_FALLBACK[plugin_type])
index = combo.findText(current)
if index == -1: if index == -1:
index = 0 index = 0
combo.setCurrentIndex(index) combo.setCurrentIndex(index)

View file

@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys import sys
if sys.platform.startswith("linux"): if sys.platform.startswith("linux"):