Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sven 2018-08-02 11:00:02 -04:00
commit c1bba50567
12 changed files with 145 additions and 45 deletions

View File

@ -19,7 +19,7 @@
- MENU/QT/WIMP: QT QSlider styling for Dark Theme.
- MENU/QT/WIMP: Remove button ghostly inside highlighting.
- MENU/QT/WIMP: Initial grid view.
- MENU/QT/WIMP: Drag&drop to add new playlist items, add option to add/delete playlists.
- MENU/QT/WIMP: Drag&drop to add new playlist items, add option to add/edit/delete playlists.
- METAL: Initial work-in-progress video driver for Metal. macOS-only right now, and currently requires macOS 10.13.
- METAL: Supports XMB/MaterialUI, has a menu display driver. Has a font rendering driver.
- METAL/SLANG: Slang shaders should be compatible with Metal video driver.

View File

@ -264,23 +264,26 @@ static bool command_read_ram(const char *arg)
{
cheevos_var_t var;
unsigned i;
char *reply = NULL;
const uint8_t * data = NULL;
char *reply_at = NULL;
unsigned int nbytes = 0;
char *reply = NULL;
const uint8_t * data = NULL;
char *reply_at = NULL;
unsigned int nbytes = 0;
unsigned int alloc_size = 0;
int addr = -1;
int addr = -1;
if (sscanf(arg, "%x %d", &addr, &nbytes) != 2)
return true;
alloc_size = 40 + nbytes * 3; //We alloc more than needed, saving 20 bytes is not really relevant
reply = (char*) malloc(alloc_size);
reply[0] = '\0';
reply_at = reply + sprintf(reply, SMY_CMD_STR " %x", addr);
var.value = addr;
alloc_size = 40 + nbytes * 3; /* We alloc more than needed, saving 20 bytes is not really relevant */
reply = (char*) malloc(alloc_size);
reply[0] = '\0';
reply_at = reply + sprintf(reply, SMY_CMD_STR " %x", addr);
var.value = addr;
cheevos_var_patch_addr(&var, cheevos_get_console());
data = cheevos_var_get_memory(&var);
data = cheevos_var_get_memory(&var);
if (data)
{

View File

@ -223,8 +223,8 @@ static const struct wl_keyboard_listener keyboard_listener = {
keyboard_handle_enter,
keyboard_handle_leave,
keyboard_handle_key,
keyboard_handle_modifiers
//keyboard_handle_repeat_info
keyboard_handle_modifiers,
keyboard_handle_repeat_info
};
static void gfx_ctx_wl_show_mouse(void *data, bool state);

View File

@ -3672,6 +3672,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
"まずひとつのプレイリストを選択してください。")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DELETE,
"削除")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY,
"エントリー作成...")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FILES,
"ファイルを追加...")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER,
@ -3686,3 +3688,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE,
"<複数>")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY,
"プレイリストエントリーを更新するに失敗しました。")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS,
"必須フィールドがすべて入力されていることを確認してください。")

View File

@ -4196,6 +4196,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
"Please choose a single playlist first.")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DELETE,
"Delete")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY,
"Add Entry...")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FILES,
"Add File(s)...")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER,
@ -4210,3 +4212,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE,
"<multiple>")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY,
"Error updating playlist entry.")
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS,
"Please fill out all required fields.")

View File

@ -922,7 +922,7 @@ void fill_pathname_join_delim(char *out_path, const char *dir,
const char *path, const char delim, size_t size)
{
size_t copied;
// behavior of strlcpy is undefined if dst and src overlap
/* behavior of strlcpy is undefined if dst and src overlap */
if (out_path == dir)
copied = strlen(dir);
else

View File

@ -52,7 +52,7 @@ enum cheat_search_type
CHEAT_SEARCH_TYPE_EQ,
CHEAT_SEARCH_TYPE_NEQ,
CHEAT_SEARCH_TYPE_EQPLUS,
CHEAT_SEARCH_TYPE_EQMINUS,
CHEAT_SEARCH_TYPE_EQMINUS
};
enum cheat_match_action_type
@ -113,19 +113,19 @@ struct item_cheat
* 1 : 11110000
*/
unsigned int address_mask ;
//Whether to apply the cheat based on big-endian console memory or not
/* Whether to apply the cheat based on big-endian console memory or not */
bool big_endian ;
unsigned int rumble_type ;
unsigned int rumble_value ;
unsigned int rumble_prev_value ;
unsigned int rumble_initialized ;
unsigned int rumble_port ; //0-15 for specific port, anything else means "all ports"
unsigned int rumble_primary_strength ; //0-65535
unsigned int rumble_primary_duration ; //in milliseconds
retro_time_t rumble_primary_end_time ; //clock value for when rumbling should stop
unsigned int rumble_secondary_strength ; //0-65535
unsigned int rumble_secondary_duration ; //in milliseconds
retro_time_t rumble_secondary_end_time ; //clock value for when rumbling should stop
unsigned int rumble_port ; /* 0-15 for specific port, anything else means "all ports" */
unsigned int rumble_primary_strength ; /* 0-65535 */
unsigned int rumble_primary_duration ; /* in milliseconds */
retro_time_t rumble_primary_end_time ; /* clock value for when rumbling should stop */
unsigned int rumble_secondary_strength ; /* 0-65535 */
unsigned int rumble_secondary_duration ; /* in milliseconds */
retro_time_t rumble_secondary_end_time ; /* clock value for when rumbling should stop */
};
struct cheat_manager

View File

@ -1955,6 +1955,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS,
MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
MENU_ENUM_LABEL_VALUE_QT_DELETE,
MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY,
MENU_ENUM_LABEL_VALUE_QT_ADD_FILES,
MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER,
MENU_ENUM_LABEL_VALUE_QT_EDIT,
@ -1962,6 +1963,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER,
MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE,
MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY,
MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS,
MENU_LABEL(MIDI_INPUT),
MENU_LABEL(MIDI_OUTPUT),

View File

@ -2713,16 +2713,17 @@ static enum runloop_state runloop_check_state(
}
else
{
if ( global->menu.prev_action == action && global->menu.noop_press_time < 200000) //250ms
if ( global->menu.prev_action == action &&
global->menu.noop_press_time < 200000) /* 250ms */
{
global->menu.action_start_time = global->menu.prev_start_time ;
global->menu.action_start_time = global->menu.prev_start_time ;
global->menu.action_press_time = cpu_features_get_time_usec() - global->menu.action_start_time;
}
else
{
global->menu.prev_start_time = cpu_features_get_time_usec() ;
global->menu.prev_action = action ;
global->menu.action_press_time = 0 ;
global->menu.prev_start_time = cpu_features_get_time_usec() ;
global->menu.prev_action = action;
global->menu.action_press_time = 0;
}
}
}

View File

@ -250,7 +250,6 @@ static const QString qt_theme_dark_stylesheet = QStringLiteral(""
"}\n"
"QPushButton[flat=\"true\"] {\n"
" background-color: transparent;\n"
" border: 1px solid #ddd;\n"
"}\n"
"QRadioButton::indicator {\n"
" width:18px;\n"

View File

@ -217,6 +217,19 @@ FileDropWidget::FileDropWidget(QWidget *parent) :
setAcceptDrops(true);
}
void FileDropWidget::paintEvent(QPaintEvent *event)
{
QStyleOption o;
QPainter p;
o.initFrom(this);
p.begin(this);
style()->drawPrimitive(
QStyle::PE_Widget, &o, &p, this);
p.end();
QWidget::paintEvent(event);
}
void FileDropWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Delete)
@ -380,7 +393,14 @@ PlaylistEntryDialog::PlaylistEntryDialog(MainWindow *mainwindow, QWidget *parent
QFormLayout *form = new QFormLayout();
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *databaseVBoxLayout = new QVBoxLayout();
QHBoxLayout *pathHBoxLayout = new QHBoxLayout();
QLabel *databaseLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS), this);
QToolButton *pathPushButton = new QToolButton(this);
pathPushButton->setText("...");
pathHBoxLayout->addWidget(m_pathLineEdit);
pathHBoxLayout->addWidget(pathPushButton);
databaseVBoxLayout->addWidget(m_databaseComboBox);
databaseVBoxLayout->addWidget(databaseLabel);
@ -399,13 +419,25 @@ PlaylistEntryDialog::PlaylistEntryDialog(MainWindow *mainwindow, QWidget *parent
connect(this, SIGNAL(rejected()), this, SLOT(onRejected()));
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_NAME), m_nameLineEdit);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH), m_pathLineEdit);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH), pathHBoxLayout);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_CORE), m_coreComboBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE), databaseVBoxLayout);
qobject_cast<QVBoxLayout*>(layout())->addLayout(form);
layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
layout()->addWidget(buttonBox);
connect(pathPushButton, SIGNAL(clicked()), this, SLOT(onPathClicked()));
}
void PlaylistEntryDialog::onPathClicked()
{
QString filePath = QFileDialog::getOpenFileName(this);
if (filePath.isEmpty())
return;
m_pathLineEdit->setText(filePath);
}
void PlaylistEntryDialog::loadPlaylistOptions()
@ -1146,14 +1178,21 @@ void MainWindow::addFilesToPlaylist(QStringList files)
playlist_t *playlist = NULL;
int i;
if (files.count() == 1)
/* Assume a blank list means we will manually enter in all fields. */
if (files.isEmpty())
{
/* Make sure hash isn't blank, that would mean there's multiple entries to add at once. */
itemToAdd["label"] = "";
itemToAdd["path"] = "";
}
else if (files.count() == 1)
{
QString path = files.at(0);
QFileInfo info(path);
if (info.isFile())
{
itemToAdd["label"] = info.baseName();
itemToAdd["label"] = info.completeBaseName();
itemToAdd["path"] = path;
}
}
@ -1192,6 +1231,16 @@ void MainWindow::addFilesToPlaylist(QStringList files)
dialog.reset(new QProgressDialog(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES), "Cancel", 0, 0, this));
dialog->setWindowModality(Qt::ApplicationModal);
if (selectedName.isEmpty() || selectedPath.isEmpty() ||
selectedDatabase.isEmpty())
{
ui_window.qtWindow->showMessageBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS), MainWindow::MSGBOX_TYPE_ERROR, Qt::ApplicationModal, false);
return;
}
if (files.isEmpty())
files.append(selectedPath);
for (i = 0; i < files.count(); i++)
{
QString path(files.at(i));
@ -1211,8 +1260,12 @@ void MainWindow::addFilesToPlaylist(QStringList files)
}
if (fileInfo.isFile())
{
list.append(fileInfo.absoluteFilePath());
else if (files.count() == 1)
{
/* If adding a single file, tell user that it doesn't exist. */
ui_window.qtWindow->showMessageBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST), MainWindow::MSGBOX_TYPE_ERROR, Qt::ApplicationModal, false);
return;
}
}
@ -1250,12 +1303,12 @@ void MainWindow::addFilesToPlaylist(QStringList files)
if (files.count() == 1 && list.count() == 1 && i == 0)
{
fileBaseNameArray = selectedName.toUtf8();
pathArray = selectedPath.toUtf8();
pathArray = QDir::toNativeSeparators(selectedPath).toUtf8();
}
else
{
fileBaseNameArray = fileInfo.baseName().toUtf8();
pathArray = fileName.toUtf8();
fileBaseNameArray = fileInfo.completeBaseName().toUtf8();
pathArray = QDir::toNativeSeparators(fileName).toUtf8();
}
fileNameNoExten = fileBaseNameArray.constData();
@ -1272,7 +1325,7 @@ void MainWindow::addFilesToPlaylist(QStringList files)
}
else
{
corePathArray = selectedCore.value("core_path").toUtf8();
corePathArray = QDir::toNativeSeparators(selectedCore.value("core_path")).toUtf8();
coreNameArray = selectedCore.value("core_name").toUtf8();
corePathData = corePathArray.constData();
coreNameData = coreNameArray.constData();
@ -1290,7 +1343,7 @@ void MainWindow::addFilesToPlaylist(QStringList files)
if (list->size == 1)
{
/* assume archives with one file should have that file loaded directly */
pathArray = (QString(pathData) + "#" + list->elems[0].data).toUtf8();
pathArray = QDir::toNativeSeparators(QString(pathData) + "#" + list->elems[0].data).toUtf8();
pathData = pathArray.constData();
}
@ -1592,10 +1645,10 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
return false;
playlistPathArray = playlistPath.toUtf8();
pathArray = path.toUtf8();
pathArray = QDir::toNativeSeparators(path).toUtf8();
labelArray = label.toUtf8();
coreNameArray = coreName.toUtf8();
corePathArray = corePath.toUtf8();
corePathArray = QDir::toNativeSeparators(corePath).toUtf8();
dbNameArray = (dbName + file_path_str(FILE_PATH_LPL_EXTENSION)).toUtf8();
crc32Array = crc32.toUtf8();
@ -1607,6 +1660,23 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
dbNameData = dbNameArray.constData();
crc32Data = crc32Array.constData();
if (path_is_compressed_file(pathData))
{
struct string_list *list = file_archive_get_file_list(pathData, NULL);
if (list)
{
if (list->size == 1)
{
/* assume archives with one file should have that file loaded directly */
pathArray = QDir::toNativeSeparators(QString(pathData) + "#" + list->elems[0].data).toUtf8();
pathData = pathArray.constData();
}
string_list_free(list);
}
}
playlist = playlist_init(playlistPathData, COLLECTION_SIZE);
playlist_update(playlist, index, pathData, labelData,
@ -1622,6 +1692,7 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
{
QScopedPointer<QMenu> menu;
QScopedPointer<QAction> addEntryAction;
QScopedPointer<QAction> addFilesAction;
QScopedPointer<QAction> addFolderAction;
QScopedPointer<QAction> editAction;
@ -1632,11 +1703,13 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
menu.reset(new QMenu(this));
addEntryAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY)), this));
addFilesAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ADD_FILES)), this));
addFolderAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER)), this));
editAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_EDIT)), this));
deleteAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_DELETE)), this));
menu->addAction(addEntryAction.data());
menu->addAction(addFilesAction.data());
menu->addAction(addFolderAction.data());
@ -1658,6 +1731,10 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
if (!filePaths.isEmpty())
addFilesToPlaylist(filePaths);
}
else if (selectedAction == addEntryAction.data())
{
addFilesToPlaylist(QStringList());
}
else if (selectedAction == addFolderAction.data())
{
QString dirPath = QFileDialog::getExistingDirectory(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER), QString(), QFileDialog::ShowDirsOnly);
@ -2650,7 +2727,7 @@ void MainWindow::selectBrowserDir(QString path)
hash["path"] = filePath;
hash["label"] = hash["path"];
hash["label_noext"] = fileInfo.fileName().remove(QString(".") + fileInfo.completeSuffix());
hash["label_noext"] = fileInfo.completeBaseName();
hash["db_name"] = fileInfo.dir().dirName();
item->setData(Qt::UserRole, QVariant::fromValue<QHash<QString, QString> >(hash));
@ -2987,13 +3064,20 @@ void MainWindow::onRunClicked()
ViewType viewType = getCurrentViewType();
QHash<QString, QString> contentHash;
if (!item)
return;
if (viewType == VIEW_TYPE_LIST)
{
if (!item)
return;
contentHash = item->data(Qt::UserRole).value<QHash<QString, QString> >();
}
else if (viewType == VIEW_TYPE_ICONS)
{
contentHash = m_currentGridHash;
if (contentHash.isEmpty())
return;
}
else
return;

View File

@ -153,6 +153,7 @@ protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void keyPressEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
};
class TableWidget : public QTableWidget
@ -196,6 +197,8 @@ public slots:
void hideDialog();
void onAccepted();
void onRejected();
private slots:
void onPathClicked();
private:
void loadPlaylistOptions();