mirror of https://github.com/mgba-emu/mgba.git
fix compilation warnings
This commit is contained in:
parent
cf54ddd864
commit
3571b112dc
|
@ -14,10 +14,6 @@
|
||||||
#define CXX_GUARD_END
|
#define CXX_GUARD_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
#define __USE_MINGW_ANSI_STDIO 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CXX_GUARD_START
|
CXX_GUARD_START
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <mgba-util/common.h>
|
#include <mgba-util/common.h>
|
||||||
|
|
||||||
#define _WIN32_WINNT 0x0600
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define THREAD_ENTRY DWORD WINAPI
|
#define THREAD_ENTRY DWORD WINAPI
|
||||||
typedef THREAD_ENTRY ThreadEntry(LPVOID);
|
typedef THREAD_ENTRY ThreadEntry(LPVOID);
|
||||||
|
|
|
@ -218,17 +218,17 @@ ADD_CALLBACK(savedataUpdated)
|
||||||
ADD_CALLBACK(alarm)
|
ADD_CALLBACK(alarm)
|
||||||
|
|
||||||
#undef ADD_CALLBACK
|
#undef ADD_CALLBACK
|
||||||
#define CALLBACK(NAME) _script_ ## NAME
|
#define SCRIPT(NAME) _script_ ## NAME
|
||||||
|
|
||||||
static void _mCoreThreadAddCallbacks(struct mCoreThread* threadContext) {
|
static void _mCoreThreadAddCallbacks(struct mCoreThread* threadContext) {
|
||||||
struct mCoreCallbacks callbacks = {
|
struct mCoreCallbacks callbacks = {
|
||||||
.videoFrameEnded = CALLBACK(frame),
|
.videoFrameEnded = SCRIPT(frame),
|
||||||
.coreCrashed = CALLBACK(crashed),
|
.coreCrashed = SCRIPT(crashed),
|
||||||
.sleep = CALLBACK(sleep),
|
.sleep = SCRIPT(sleep),
|
||||||
.shutdown = CALLBACK(stop),
|
.shutdown = SCRIPT(stop),
|
||||||
.keysRead = CALLBACK(keysRead),
|
.keysRead = SCRIPT(keysRead),
|
||||||
.savedataUpdated = CALLBACK(savedataUpdated),
|
.savedataUpdated = SCRIPT(savedataUpdated),
|
||||||
.alarm = CALLBACK(alarm),
|
.alarm = SCRIPT(alarm),
|
||||||
.context = threadContext
|
.context = threadContext
|
||||||
};
|
};
|
||||||
threadContext->core->addCoreCallbacks(threadContext->core, &callbacks);
|
threadContext->core->addCoreCallbacks(threadContext->core, &callbacks);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
|
|
||||||
|
#define SDL_MAIN_HANDLED
|
||||||
#include "platform/sdl/sdl-audio.h"
|
#include "platform/sdl/sdl-audio.h"
|
||||||
|
|
||||||
namespace QGBA {
|
namespace QGBA {
|
||||||
|
|
|
@ -44,13 +44,11 @@ bool ColorPicker::eventFilter(QObject* obj, QEvent* event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* swatch = static_cast<QWidget*>(obj);
|
|
||||||
|
|
||||||
QColorDialog* colorPicker = new QColorDialog;
|
QColorDialog* colorPicker = new QColorDialog;
|
||||||
colorPicker->setAttribute(Qt::WA_DeleteOnClose);
|
colorPicker->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
colorPicker->setCurrentColor(m_defaultColor);
|
colorPicker->setCurrentColor(m_defaultColor);
|
||||||
colorPicker->open();
|
colorPicker->open();
|
||||||
connect(colorPicker, &QColorDialog::colorSelected, [this, swatch](const QColor& color) {
|
connect(colorPicker, &QColorDialog::colorSelected, [this](const QColor& color) {
|
||||||
setColor(color);
|
setColor(color);
|
||||||
emit colorChanged(color);
|
emit colorChanged(color);
|
||||||
});
|
});
|
||||||
|
|
|
@ -232,9 +232,9 @@ bool ForwarderController::toolInstalled(const QString& tool) {
|
||||||
|
|
||||||
void ForwarderController::connectReply(QNetworkReply* reply, Download download, void (ForwarderController::*next)(QNetworkReply*)) {
|
void ForwarderController::connectReply(QNetworkReply* reply, Download download, void (ForwarderController::*next)(QNetworkReply*)) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||||
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply]() {
|
connect(reply, &QNetworkReply::errorOccurred, this, [this]() {
|
||||||
#else
|
#else
|
||||||
connect(reply, qOverload<>(&QNetworkReply::error), this, [this, reply]() {
|
connect(reply, qOverload<>(&QNetworkReply::error), this, [this]() {
|
||||||
#endif
|
#endif
|
||||||
emit buildFailed();
|
emit buildFailed();
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
System system() const override { return System::N3DS; }
|
System system() const override { return System::N3DS; }
|
||||||
QString extension() const override { return QLatin1String("cia"); }
|
QString extension() const override { return QLatin1String("cia"); }
|
||||||
|
|
||||||
virtual QStringList externalTools() const { return {"bannertool", "3dstool", "ctrtool", "makerom"}; }
|
virtual QStringList externalTools() const override { return {"bannertool", "3dstool", "ctrtool", "makerom"}; }
|
||||||
|
|
||||||
void rebuild(const QString& source, const QString& target) override;
|
void rebuild(const QString& source, const QString& target) override;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "KeyEditor.h"
|
#include "KeyEditor.h"
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
|
#define SDL_MAIN_HANDLED
|
||||||
#include "platform/sdl/sdl-events.h"
|
#include "platform/sdl/sdl-events.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <mgba/internal/gba/gba.h>
|
#include <mgba/internal/gba/gba.h>
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
|
#define SDL_MAIN_HANDLED
|
||||||
#include "platform/sdl/sdl-events.h"
|
#include "platform/sdl/sdl-events.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ bool ShortcutController::eventFilter(QObject* obj, QEvent* event) {
|
||||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
if (m_scripting) {
|
if (m_scripting) {
|
||||||
m_scripting->event(obj, event);
|
m_scripting->scriptingEvent(obj, event);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (keyEvent->isAutoRepeat()) {
|
if (keyEvent->isAutoRepeat()) {
|
||||||
|
@ -165,7 +165,7 @@ bool ShortcutController::eventFilter(QObject* obj, QEvent* event) {
|
||||||
if (event->type() == GamepadButtonEvent::Down()) {
|
if (event->type() == GamepadButtonEvent::Down()) {
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
if (m_scripting) {
|
if (m_scripting) {
|
||||||
m_scripting->event(obj, event);
|
m_scripting->scriptingEvent(obj, event);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
auto item = m_buttons.find(static_cast<GamepadButtonEvent*>(event)->value());
|
auto item = m_buttons.find(static_cast<GamepadButtonEvent*>(event)->value());
|
||||||
|
@ -186,7 +186,7 @@ bool ShortcutController::eventFilter(QObject* obj, QEvent* event) {
|
||||||
if (event->type() == GamepadButtonEvent::Up()) {
|
if (event->type() == GamepadButtonEvent::Up()) {
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
if (m_scripting) {
|
if (m_scripting) {
|
||||||
m_scripting->event(obj, event);
|
m_scripting->scriptingEvent(obj, event);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
auto item = m_buttons.find(static_cast<GamepadButtonEvent*>(event)->value());
|
auto item = m_buttons.find(static_cast<GamepadButtonEvent*>(event)->value());
|
||||||
|
@ -224,7 +224,7 @@ bool ShortcutController::eventFilter(QObject* obj, QEvent* event) {
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
if (event->type() == GamepadHatEvent::Type()) {
|
if (event->type() == GamepadHatEvent::Type()) {
|
||||||
if (m_scripting) {
|
if (m_scripting) {
|
||||||
m_scripting->event(obj, event);
|
m_scripting->scriptingEvent(obj, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "input/Gamepad.h"
|
#include "input/Gamepad.h"
|
||||||
#include "input/InputDriver.h"
|
#include "input/InputDriver.h"
|
||||||
|
|
||||||
|
#define SDL_MAIN_HANDLED
|
||||||
|
|
||||||
#include "platform/sdl/sdl-events.h"
|
#include "platform/sdl/sdl-events.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
@ -109,8 +109,9 @@ int main(int argc, char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
qtTranslator.load(locale, "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
if (qtTranslator.load(locale, "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
|
||||||
application.installTranslator(&qtTranslator);
|
application.installTranslator(&qtTranslator);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef QT_STATIC
|
#ifdef QT_STATIC
|
||||||
QTranslator qtStaticTranslator;
|
QTranslator qtStaticTranslator;
|
||||||
|
@ -119,8 +120,9 @@ int main(int argc, char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTranslator langTranslator;
|
QTranslator langTranslator;
|
||||||
langTranslator.load(locale, binaryName, "-", ":/translations/");
|
if (langTranslator.load(locale, binaryName, "-", ":/translations/")) {
|
||||||
application.installTranslator(&langTranslator);
|
application.installTranslator(&langTranslator);
|
||||||
|
}
|
||||||
|
|
||||||
Window* w = application.newWindow();
|
Window* w = application.newWindow();
|
||||||
w->loadConfig();
|
w->loadConfig();
|
||||||
|
|
|
@ -170,11 +170,11 @@ void ScriptingController::flushStorage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptingController::eventFilter(QObject* obj, QEvent* ev) {
|
bool ScriptingController::eventFilter(QObject* obj, QEvent* ev) {
|
||||||
event(obj, ev);
|
scriptingEvent(obj, ev);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptingController::event(QObject* obj, QEvent* event) {
|
void ScriptingController::scriptingEvent(QObject* obj, QEvent* event) {
|
||||||
if (!m_controller) {
|
if (!m_controller) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ void ScriptingController::event(QObject* obj, QEvent* event) {
|
||||||
return;
|
return;
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
case QEvent::KeyRelease: {
|
case QEvent::KeyRelease: {
|
||||||
struct mScriptKeyEvent ev{mSCRIPT_EV_TYPE_KEY};
|
struct mScriptKeyEvent ev{{mSCRIPT_EV_TYPE_KEY}};
|
||||||
auto keyEvent = static_cast<QKeyEvent*>(event);
|
auto keyEvent = static_cast<QKeyEvent*>(event);
|
||||||
ev.state = event->type() == QEvent::KeyRelease ? mSCRIPT_INPUT_STATE_UP :
|
ev.state = event->type() == QEvent::KeyRelease ? mSCRIPT_INPUT_STATE_UP :
|
||||||
static_cast<QKeyEvent*>(event)->isAutoRepeat() ? mSCRIPT_INPUT_STATE_HELD : mSCRIPT_INPUT_STATE_DOWN;
|
static_cast<QKeyEvent*>(event)->isAutoRepeat() ? mSCRIPT_INPUT_STATE_HELD : mSCRIPT_INPUT_STATE_DOWN;
|
||||||
|
@ -199,7 +199,7 @@ void ScriptingController::event(QObject* obj, QEvent* event) {
|
||||||
}
|
}
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
case QEvent::MouseButtonRelease: {
|
case QEvent::MouseButtonRelease: {
|
||||||
struct mScriptMouseButtonEvent ev{mSCRIPT_EV_TYPE_MOUSE_BUTTON};
|
struct mScriptMouseButtonEvent ev{{mSCRIPT_EV_TYPE_MOUSE_BUTTON}};
|
||||||
auto mouseEvent = static_cast<QMouseEvent*>(event);
|
auto mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
ev.mouse = 0;
|
ev.mouse = 0;
|
||||||
ev.state = event->type() == QEvent::MouseButtonPress ? mSCRIPT_INPUT_STATE_DOWN : mSCRIPT_INPUT_STATE_UP;
|
ev.state = event->type() == QEvent::MouseButtonPress ? mSCRIPT_INPUT_STATE_DOWN : mSCRIPT_INPUT_STATE_UP;
|
||||||
|
@ -208,7 +208,7 @@ void ScriptingController::event(QObject* obj, QEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case QEvent::MouseMove: {
|
case QEvent::MouseMove: {
|
||||||
struct mScriptMouseMoveEvent ev{mSCRIPT_EV_TYPE_MOUSE_MOVE};
|
struct mScriptMouseMoveEvent ev{{mSCRIPT_EV_TYPE_MOUSE_MOVE}};
|
||||||
auto mouseEvent = static_cast<QMouseEvent*>(event);
|
auto mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
QPoint pos = mouseEvent->pos();
|
QPoint pos = mouseEvent->pos();
|
||||||
pos = static_cast<Display*>(obj)->normalizedPoint(m_controller.get(), pos);
|
pos = static_cast<Display*>(obj)->normalizedPoint(m_controller.get(), pos);
|
||||||
|
@ -219,7 +219,7 @@ void ScriptingController::event(QObject* obj, QEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case QEvent::Wheel: {
|
case QEvent::Wheel: {
|
||||||
struct mScriptMouseWheelEvent ev{mSCRIPT_EV_TYPE_MOUSE_WHEEL};
|
struct mScriptMouseWheelEvent ev{{mSCRIPT_EV_TYPE_MOUSE_WHEEL}};
|
||||||
auto wheelEvent = static_cast<QWheelEvent*>(event);
|
auto wheelEvent = static_cast<QWheelEvent*>(event);
|
||||||
QPoint adelta = wheelEvent->angleDelta();
|
QPoint adelta = wheelEvent->angleDelta();
|
||||||
QPoint pdelta = wheelEvent->pixelDelta();
|
QPoint pdelta = wheelEvent->pixelDelta();
|
||||||
|
@ -240,7 +240,7 @@ void ScriptingController::event(QObject* obj, QEvent* event) {
|
||||||
|
|
||||||
auto type = event->type();
|
auto type = event->type();
|
||||||
if (type == GamepadButtonEvent::Down() || type == GamepadButtonEvent::Up()) {
|
if (type == GamepadButtonEvent::Down() || type == GamepadButtonEvent::Up()) {
|
||||||
struct mScriptGamepadButtonEvent ev{mSCRIPT_EV_TYPE_GAMEPAD_BUTTON};
|
struct mScriptGamepadButtonEvent ev{{mSCRIPT_EV_TYPE_GAMEPAD_BUTTON}};
|
||||||
auto gamepadEvent = static_cast<GamepadButtonEvent*>(event);
|
auto gamepadEvent = static_cast<GamepadButtonEvent*>(event);
|
||||||
ev.pad = 0;
|
ev.pad = 0;
|
||||||
ev.state = event->type() == GamepadButtonEvent::Down() ? mSCRIPT_INPUT_STATE_DOWN : mSCRIPT_INPUT_STATE_UP;
|
ev.state = event->type() == GamepadButtonEvent::Down() ? mSCRIPT_INPUT_STATE_DOWN : mSCRIPT_INPUT_STATE_UP;
|
||||||
|
@ -248,7 +248,7 @@ void ScriptingController::event(QObject* obj, QEvent* event) {
|
||||||
mScriptContextFireEvent(&m_scriptContext, &ev.d);
|
mScriptContextFireEvent(&m_scriptContext, &ev.d);
|
||||||
}
|
}
|
||||||
if (type == GamepadHatEvent::Type()) {
|
if (type == GamepadHatEvent::Type()) {
|
||||||
struct mScriptGamepadHatEvent ev{mSCRIPT_EV_TYPE_GAMEPAD_HAT};
|
struct mScriptGamepadHatEvent ev{{mSCRIPT_EV_TYPE_GAMEPAD_HAT}};
|
||||||
updateGamepad();
|
updateGamepad();
|
||||||
auto gamepadEvent = static_cast<GamepadHatEvent*>(event);
|
auto gamepadEvent = static_cast<GamepadHatEvent*>(event);
|
||||||
ev.pad = 0;
|
ev.pad = 0;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
bool loadFile(const QString& path);
|
bool loadFile(const QString& path);
|
||||||
bool load(VFileDevice& vf, const QString& name);
|
bool load(VFileDevice& vf, const QString& name);
|
||||||
|
|
||||||
void event(QObject* obj, QEvent* ev);
|
void scriptingEvent(QObject* obj, QEvent* ev);
|
||||||
|
|
||||||
mScriptContext* context() { return &m_scriptContext; }
|
mScriptContext* context() { return &m_scriptContext; }
|
||||||
ScriptingTextBufferModel* textBufferModel() const { return m_bufferModel; }
|
ScriptingTextBufferModel* textBufferModel() const { return m_bufferModel; }
|
||||||
|
|
|
@ -47,6 +47,7 @@ static void _loadState(struct mCoreThread* thread) {
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
#endif
|
#endif
|
||||||
struct mSDLRenderer renderer = {0};
|
struct mSDLRenderer renderer = {0};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue