update gui

This commit is contained in:
Logan McNaughton committed 2021-05-31 10:54:38 -06:00
1 parent 15a8b9bf89
commit 2b81327ebc
9 files changed
+37 -291

No files matched your search

+9 -9
View File
@@ -96,7 +96,7 @@ static char* media_loader_get_gb_cart_rom(void*, int control_id)
if (pathname.isEmpty())
return NULL;
else {
char *path = strdup(pathname.toLocal8Bit().constData());
char *path = strdup(pathname.toUtf8().constData());
return path;
}
}
@@ -116,7 +116,7 @@ static char* media_loader_get_gb_cart_ram(void*, int control_id)
if (pathname.isEmpty())
return NULL;
else {
char *path = strdup(pathname.toLocal8Bit().constData());
char *path = strdup(pathname.toUtf8().constData());
return path;
}
}
@@ -128,7 +128,7 @@ static char* media_loader_get_dd_rom(void*)
if (pathname.isEmpty())
return NULL;
else {
char *path = strdup(pathname.toLocal8Bit().constData());
char *path = strdup(pathname.toUtf8().constData());
return path;
}
}
@@ -140,7 +140,7 @@ static char* media_loader_get_dd_disk(void*)
if (pathname.isEmpty())
return NULL;
else {
char *path = strdup(pathname.toLocal8Bit().constData());
char *path = strdup(pathname.toUtf8().constData());
return path;
}
@@ -172,7 +172,7 @@ m64p_error loadROM(QString filename)
romlength = data.size();
if (romlength == 0)
{
DebugMessage(M64MSG_ERROR, "couldn't open file '%s' for reading.", filename.toLocal8Bit().constData());
DebugMessage(M64MSG_ERROR, "couldn't open file '%s' for reading.", filename.toUtf8().constData());
return M64ERR_INVALID_STATE;
}
ROM_buffer = (char *) malloc(romlength);
@@ -184,7 +184,7 @@ m64p_error loadROM(QString filename)
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
{
DebugMessage(M64MSG_ERROR, "couldn't open ROM file '%s' for reading.", filename.toLocal8Bit().constData());
DebugMessage(M64MSG_ERROR, "couldn't open ROM file '%s' for reading.", filename.toUtf8().constData());
return M64ERR_INVALID_STATE;
}
@@ -193,7 +193,7 @@ m64p_error loadROM(QString filename)
ROM_buffer = (char *) malloc(romlength);
if (in.readRawData(ROM_buffer, romlength) == -1)
{
DebugMessage(M64MSG_ERROR, "couldn't read %li bytes from ROM image file '%s'.", romlength, filename.toLocal8Bit().constData());
DebugMessage(M64MSG_ERROR, "couldn't read %li bytes from ROM image file '%s'.", romlength, filename.toUtf8().constData());
free(ROM_buffer);
file.close();
return M64ERR_INVALID_STATE;
@@ -204,7 +204,7 @@ m64p_error loadROM(QString filename)
/* Try to load the ROM image into the core */
if ((*CoreDoCommand)(M64CMD_ROM_OPEN, (int) romlength, ROM_buffer) != M64ERR_SUCCESS)
{
DebugMessage(M64MSG_ERROR, "core failed to open ROM image file '%s'.", filename.toLocal8Bit().constData());
DebugMessage(M64MSG_ERROR, "core failed to open ROM image file '%s'.", filename.toUtf8().constData());
free(ROM_buffer);
return M64ERR_INVALID_STATE;
}
@@ -274,7 +274,7 @@ m64p_error launchGame(QString netplay_ip, int netplay_port, int netplay_player)
{
DebugMessage(M64MSG_INFO, "Netplay: using core version %u", version);
if ((*CoreDoCommand)(M64CMD_NETPLAY_INIT, netplay_port, netplay_ip.toLocal8Bit().data()) == M64ERR_SUCCESS)
if ((*CoreDoCommand)(M64CMD_NETPLAY_INIT, netplay_port, netplay_ip.toUtf8().data()) == M64ERR_SUCCESS)
DebugMessage(M64MSG_INFO, "Netplay: init success");
uint32_t reg_id = 0;
+17 -14
View File
@@ -474,12 +474,15 @@ void MainWindow::setupLLE()
ui->actionVideo_Settings->setEnabled(!settings->value("LLE").toInt());
ui->actionLLE_Graphics->setChecked(settings->value("LLE").toInt());
m64p_handle lionConfigHandle;
m64p_error res = (*ConfigOpenSection)("Video-Angrylion-Plus", &lionConfigHandle);
if (res == M64ERR_SUCCESS)
if (coreLib)
{
int vimode = (*ConfigGetParamInt)(lionConfigHandle, "ViMode");
ui->actionVI_Filter->setChecked(!vimode);
m64p_handle lionConfigHandle;
m64p_error res = (*ConfigOpenSection)("Video-Angrylion-Plus", &lionConfigHandle);
if (res == M64ERR_SUCCESS)
{
int vimode = (*ConfigGetParamInt)(lionConfigHandle, "ViMode");
ui->actionVI_Filter->setChecked(!vimode);
}
}
ui->actionVI_Filter->setEnabled(settings->value("LLE").toInt());
@@ -969,7 +972,7 @@ void MainWindow::on_actionSave_State_To_triggered()
if (!filename.isNull()) {
if (!filename.contains(".st"))
filename.append(".state");
(*CoreDoCommand)(M64CMD_STATE_SAVE, 1, filename.toLocal8Bit().data());
(*CoreDoCommand)(M64CMD_STATE_SAVE, 1, filename.toUtf8().data());
}
}
@@ -978,7 +981,7 @@ void MainWindow::on_actionLoad_State_From_triggered()
QString filename = QFileDialog::getOpenFileName(this,
tr("Open Save State"), NULL, tr("State Files (*.st* *.pj*)"));
if (!filename.isNull()) {
(*CoreDoCommand)(M64CMD_STATE_LOAD, 1, filename.toLocal8Bit().data());
(*CoreDoCommand)(M64CMD_STATE_LOAD, 1, filename.toUtf8().data());
}
}
@@ -1096,7 +1099,7 @@ void MainWindow::loadCoreLib()
QString corePath = settings->value("coreLibPath").toString();
corePath.replace("$APP_PATH$", QCoreApplication::applicationDirPath());
m64p_error res = osal_dynlib_open(&coreLib, QDir(corePath).filePath(OSAL_DEFAULT_DYNLIB_FILENAME).toLocal8Bit().constData());
m64p_error res = osal_dynlib_open(&coreLib, QDir(corePath).filePath(OSAL_DEFAULT_DYNLIB_FILENAME).toUtf8().constData());
if (res != M64ERR_SUCCESS)
{
@@ -1131,9 +1134,9 @@ void MainWindow::loadCoreLib()
qtConfigDir.replace("$CONFIG_PATH$", ConfigGetUserConfigPath());
if (!qtConfigDir.isEmpty())
(*CoreStartup)(CORE_API_VERSION, qtConfigDir.toLocal8Bit().constData() /*Config dir*/, QCoreApplication::applicationDirPath().toLocal8Bit().constData(), (char*)"Core", DebugCallback, NULL, NULL);
(*CoreStartup)(CORE_API_VERSION, qtConfigDir.toUtf8().constData() /*Config dir*/, QCoreApplication::applicationDirPath().toUtf8().constData(), (char*)"Core", DebugCallback, NULL, NULL);
else
(*CoreStartup)(CORE_API_VERSION, NULL /*Config dir*/, QCoreApplication::applicationDirPath().toLocal8Bit().constData(), (char*)"Core", DebugCallback, NULL, NULL);
(*CoreStartup)(CORE_API_VERSION, NULL /*Config dir*/, QCoreApplication::applicationDirPath().toUtf8().constData(), (char*)"Core", DebugCallback, NULL, NULL);
CoreOverrideVidExt(&vidExtFunctions);
}
@@ -1194,7 +1197,7 @@ void MainWindow::loadPlugins()
}
else
plugin_path = QDir(pluginPath).filePath(settings->value("videoPlugin").toString());
res = osal_dynlib_open(&gfxPlugin, plugin_path.toLocal8Bit().constData());
res = osal_dynlib_open(&gfxPlugin, plugin_path.toUtf8().constData());
if (res != M64ERR_SUCCESS)
{
msgBox.setText("Failed to load video plugin");
@@ -1203,7 +1206,7 @@ void MainWindow::loadPlugins()
}
PluginStartup = (ptr_PluginStartup) osal_dynlib_getproc(gfxPlugin, "PluginStartup");
(*PluginStartup)(coreLib, (char*)"Video", DebugCallback);
res = osal_dynlib_open(&audioPlugin, QDir(pluginPath).filePath(settings->value("audioPlugin").toString()).toLocal8Bit().constData());
res = osal_dynlib_open(&audioPlugin, QDir(pluginPath).filePath(settings->value("audioPlugin").toString()).toUtf8().constData());
if (res != M64ERR_SUCCESS)
{
msgBox.setText("Failed to load audio plugin");
@@ -1212,7 +1215,7 @@ void MainWindow::loadPlugins()
}
PluginStartup = (ptr_PluginStartup) osal_dynlib_getproc(audioPlugin, "PluginStartup");
(*PluginStartup)(coreLib, (char*)"Audio", DebugCallback);
res = osal_dynlib_open(&inputPlugin, QDir(pluginPath).filePath(settings->value("inputPlugin").toString()).toLocal8Bit().constData());
res = osal_dynlib_open(&inputPlugin, QDir(pluginPath).filePath(settings->value("inputPlugin").toString()).toUtf8().constData());
if (res != M64ERR_SUCCESS)
{
msgBox.setText("Failed to load input plugin");
@@ -1233,7 +1236,7 @@ void MainWindow::loadPlugins()
}
else
plugin_path = QDir(pluginPath).filePath(settings->value("rspPlugin").toString());
res = osal_dynlib_open(&rspPlugin, plugin_path.toLocal8Bit().constData());
res = osal_dynlib_open(&rspPlugin, plugin_path.toUtf8().constData());
if (res != M64ERR_SUCCESS)
{
msgBox.setText("Failed to load rsp plugin");
+2 -5
View File
@@ -49,8 +49,7 @@ DEFINES += SINGLE_THREAD
}
win32 {
SOURCES += osal/osal_dynamiclib_win32.c \
osal/osal_files_win32.c
SOURCES += osal/osal_dynamiclib_win32.c
win32-msvc* {
!contains(QMAKE_TARGET.arch, x86_64) {
@@ -62,7 +61,6 @@ SOURCES += osal/osal_dynamiclib_win32.c \
}
INCLUDEPATH += ../mupen64plus-win32-deps/SDL2-2.0.6/include
} else {
DEFINES -= UNICODE
LIBS += -Wl,-Bdynamic -lSDL2
INCLUDEPATH += /mingw64/include/SDL2 /mingw32/include/SDL2
}
@@ -71,8 +69,7 @@ SOURCES += osal/osal_dynamiclib_win32.c \
!win32 {
QT += dbus
SOURCES += osal/osal_dynamiclib_unix.c \
osal/osal_files_unix.c
SOURCES += osal/osal_dynamiclib_unix.c
LIBS += -L/usr/local/lib -ldl -lSDL2 -lz
INCLUDEPATH += /usr/local/include /usr/include/SDL2 /usr/local/include/SDL2
+2 -2
View File
@@ -105,7 +105,7 @@ WaitRoom::WaitRoom(QString filename, QJsonObject room, QWebSocket *socket, QWidg
strcpy(assets.large_image, "6205049");
strcpy(assets.large_text, "https://m64p.github.io");
activity.assets = assets;
strncpy(activity.details, room.value("game_name").toString().toLocal8Bit().constData(), 128);
strncpy(activity.details, room.value("game_name").toString().toUtf8().constData(), 128);
strcpy(activity.state, "Netplay waiting room");
w->updateDiscordActivity(activity);
}
@@ -128,7 +128,7 @@ void WaitRoom::discordCheck(int state)
return;
if (state == Qt::Checked)
w->getDiscordApp()->lobbies->connect_lobby(w->getDiscordApp()->lobbies, discord_id.toLongLong(), discord_secret.toLocal8Bit().data(), w->getDiscordApp(), discordConnectCallback);
w->getDiscordApp()->lobbies->connect_lobby(w->getDiscordApp()->lobbies, discord_id.toLongLong(), discord_secret.toUtf8().data(), w->getDiscordApp(), discordConnectCallback);
else if (state == Qt::Unchecked)
w->getDiscordApp()->lobbies->disconnect_voice(w->getDiscordApp()->lobbies, discord_id.toLongLong(), &discord_id, discordDisconnectCallback);
}
+3 -1
View File
@@ -32,7 +32,9 @@ m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibra
if (pLibHandle == NULL || pccLibraryPath == NULL)
return M64ERR_INPUT_ASSERT;
*pLibHandle = LoadLibrary(pccLibraryPath);
wchar_t wstr[256];
mbstowcs(wstr, pccLibraryPath, 256);
*pLibHandle = LoadLibrary(wstr);
if (*pLibHandle == NULL)
{
-49
View File
@@ -1,49 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_files.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This header file is for all kinds of system-dependent file handling
*
*/
#if !defined(OSAL_FILES_H)
#define OSAL_FILES_H
#include "m64p_types.h"
#include "osal_preproc.h"
/* data structure for linked list of shared libraries found in a directory */
typedef struct _osal_lib_search {
char filepath[PATH_MAX];
char *filename;
m64p_plugin_type plugin_type;
struct _osal_lib_search *next;
} osal_lib_search;
/* const definitions for system directories to search when looking for mupen64plus plugins */
extern const int osal_libsearchdirs;
extern const char *osal_libsearchpath[];
/* functions for searching for shared libraries in a given directory */
extern osal_lib_search *osal_library_search(const char *searchpath);
extern void osal_free_lib_list(osal_lib_search *head);
#endif /* #define OSAL_FILES_H */
-105
View File
@@ -1,105 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_files_unix.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This implements all kinds of system-dependent file handling
*
*/
#include <dirent.h> // for opendir(), readdir(), closedir()
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "m64p_types.h"
#include "common.h"
#include "osal_files.h"
#include "osal_preproc.h"
osal_lib_search *osal_library_search(const char *searchpath)
{
osal_lib_search *head = NULL, *curr = NULL;
DIR *dir;
struct dirent *entry;
#ifdef __APPLE__
const char* suffix = ".dylib";
#else
const char* suffix = ".so";
#endif
dir = opendir(searchpath);
if (dir == NULL)
return NULL;
/* look for any shared libraries in this folder */
while ((entry = readdir(dir)) != NULL)
{
osal_lib_search *newlib = NULL;
if (strcmp(entry->d_name + strlen(entry->d_name) - strlen(suffix), suffix) != 0)
continue;
/* this is a .so file, so add it to the list */
newlib = malloc(sizeof(osal_lib_search));
if (newlib == NULL)
{
DebugMessage(M64MSG_ERROR, "Memory allocation error in osal_library_search()!");
osal_free_lib_list(head);
closedir(dir);
return NULL;
}
if (head == NULL)
{
head = curr = newlib;
}
else
{
curr->next = newlib;
curr = newlib;
}
/* set up the filepath and filename members */
strncpy(curr->filepath, searchpath, PATH_MAX-2);
curr->filepath[PATH_MAX-2] = 0;
if (curr->filepath[strlen(curr->filepath)-1] != '/')
strcat(curr->filepath, "/");
int pathlen = strlen(curr->filepath);
curr->filename = curr->filepath + pathlen;
strncat(curr->filepath, entry->d_name, PATH_MAX - pathlen - 1);
curr->filepath[PATH_MAX-1] = 0;
/* set plugin_type and next pointer */
curr->plugin_type = 0;
curr->next = NULL;
}
closedir(dir);
return head;
}
void osal_free_lib_list(osal_lib_search *head)
{
while (head != NULL)
{
osal_lib_search *next = head->next;
free(head);
head = next;
}
}
-102
View File
@@ -1,102 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_files_win32.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This implements all kinds of system-dependent file handling
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include "m64p_types.h"
#include "common.h"
#include "osal_files.h"
#include "osal_preproc.h"
osal_lib_search *osal_library_search(const char *searchpath)
{
osal_lib_search *head = NULL, *curr = NULL;
WIN32_FIND_DATA entry;
HANDLE hDir;
char *pchSearchPath = (char *) malloc(strlen(searchpath) + 16);
if (pchSearchPath == NULL)
{
DebugMessage(M64MSG_ERROR, "Couldn't allocate memory for file search path in osal_library_search()!");
return NULL;
}
sprintf(pchSearchPath, "%s\\*.dll", searchpath);
hDir = FindFirstFile(pchSearchPath, &entry);
free(pchSearchPath);
if (hDir == INVALID_HANDLE_VALUE)
return NULL;
/* look for any shared libraries in this folder */
do
{
osal_lib_search *newlib = NULL;
/* this is a .dll file, so add it to the list */
newlib = (osal_lib_search *) malloc(sizeof(osal_lib_search));
if (newlib == NULL)
{
DebugMessage(M64MSG_ERROR, "Memory allocation error in osal_library_search()!");
osal_free_lib_list(head);
FindClose(hDir);
return NULL;
}
if (head == NULL)
{
head = curr = newlib;
}
else
{
curr->next = newlib;
curr = newlib;
}
/* set up the filepath and filename members */
strncpy(curr->filepath, searchpath, PATH_MAX-2);
curr->filepath[PATH_MAX-2] = 0;
if (curr->filepath[strlen(curr->filepath)-1] != '\\')
strcat(curr->filepath, "\\");
int pathlen = (int) strlen(curr->filepath);
curr->filename = curr->filepath + pathlen;
strncat(curr->filepath, entry.cFileName, PATH_MAX - pathlen - 1);
curr->filepath[PATH_MAX-1] = 0;
/* set plugin_type and next pointer */
curr->plugin_type = (m64p_plugin_type) 0;
curr->next = NULL;
} while (FindNextFile(hDir, &entry));
FindClose(hDir);
return head;
}
void osal_free_lib_list(osal_lib_search *head)
{
while (head != NULL)
{
osal_lib_search *next = head->next;
free(head);
head = next;
}
}
+4 -4
View File
@@ -13,13 +13,13 @@ CustomLineEdit::CustomLineEdit(QWidget *parent)
float f_value = this->text().toFloat();
switch (m_ParamType) {
case M64TYPE_INT:
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toLocal8Bit().constData(), m_ParamType, &i_value);
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, &i_value);
break;
case M64TYPE_FLOAT:
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toLocal8Bit().constData(), m_ParamType, &f_value);
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, &f_value);
break;
case M64TYPE_STRING:
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toLocal8Bit().constData(), m_ParamType, this->text().toLocal8Bit().constData());
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, this->text().toUtf8().constData());
break;
default:
break;
@@ -33,7 +33,7 @@ CustomCheckBox::CustomCheckBox(QWidget *parent)
{
connect(this, &QCheckBox::stateChanged, [=](int state){
int value = state == Qt::Checked ? 1 : 0;
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toLocal8Bit().constData(), m_ParamType, &value);
(*ConfigSetParameter)(m_CurrentHandle, m_ParamName.toUtf8().constData(), m_ParamType, &value);
(*ConfigSaveFile)();
});
}