mirror of https://github.com/mgba-emu/mgba.git
Qt: Preliminary build cleanup when GBA core is disabled
This commit is contained in:
parent
5b710a59fa
commit
b0157aa871
|
@ -201,7 +201,7 @@ if(PSP2 OR WII)
|
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
|
||||
endif()
|
||||
|
||||
if(DEFINED 3DS OR DEFINED PSP2 OR DEFINED WII)
|
||||
if(DEFINED 3DS OR DEFINED PSP2 OR DEFINED WII OR NOT M_CORE_GBA)
|
||||
set(USE_GDB_STUB OFF)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
mLOG_DEFINE_CATEGORY(GBA, "GBA");
|
||||
|
||||
const uint32_t GBA_ARM7TDMI_FREQUENCY = 0x1000000;
|
||||
const uint32_t GBA_COMPONENT_MAGIC = 0x1000000;
|
||||
|
||||
static const size_t GBA_ROM_MAGIC_OFFSET = 3;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "gba/audio.h"
|
||||
#include "gba/sio.h"
|
||||
|
||||
extern const uint32_t GBA_ARM7TDMI_FREQUENCY;
|
||||
#define GBA_ARM7TDMI_FREQUENCY 0x1000000U
|
||||
|
||||
enum GBAIRQ {
|
||||
IRQ_VBLANK = 0x0,
|
||||
|
|
|
@ -71,6 +71,7 @@ GameController::GameController(QObject* parent)
|
|||
, m_saveStateFlags(SAVESTATE_SCREENSHOT | SAVESTATE_SAVEDATA | SAVESTATE_CHEATS)
|
||||
, m_loadStateFlags(SAVESTATE_SCREENSHOT)
|
||||
{
|
||||
#ifdef M_CORE_GBA
|
||||
m_lux.p = this;
|
||||
m_lux.sample = [](GBALuminanceSource* context) {
|
||||
GameControllerLux* lux = static_cast<GameControllerLux*>(context);
|
||||
|
@ -82,6 +83,7 @@ GameController::GameController(QObject* parent)
|
|||
return lux->value;
|
||||
};
|
||||
setLuminanceLevel(0);
|
||||
#endif
|
||||
|
||||
m_threadContext.startCallback = [](mCoreThread* context) {
|
||||
GameController* controller = static_cast<GameController*>(context->userData);
|
||||
|
@ -197,13 +199,16 @@ GameController::GameController(QObject* parent)
|
|||
return;
|
||||
}
|
||||
GameController* controller = static_cast<GameController*>(context->userData);
|
||||
#ifdef M_CORE_GBA
|
||||
if (level == mLOG_STUB && category == _mLOG_CAT_GBA_BIOS()) {
|
||||
va_list argc;
|
||||
va_copy(argc, args);
|
||||
int immediate = va_arg(argc, int);
|
||||
va_end(argc);
|
||||
QMetaObject::invokeMethod(controller, "unimplementedBiosCall", Q_ARG(int, immediate));
|
||||
} else if (category == _mLOG_CAT_STATUS()) {
|
||||
} else
|
||||
#endif
|
||||
if (category == _mLOG_CAT_STATUS()) {
|
||||
// Slot 0 is reserved for suspend points
|
||||
if (strncmp(savestateMessage, format, strlen(savestateMessage)) == 0) {
|
||||
va_list argc;
|
||||
|
@ -503,6 +508,10 @@ void GameController::importSharkport(const QString& path) {
|
|||
if (!isLoaded()) {
|
||||
return;
|
||||
}
|
||||
#ifdef M_CORE_GBA
|
||||
if (platform() != PLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
VFile* vf = VFileDevice::open(path, O_RDONLY);
|
||||
if (!vf) {
|
||||
LOG(QT, ERROR) << tr("Failed to open snapshot file for reading: %1").arg(path);
|
||||
|
@ -512,12 +521,17 @@ void GameController::importSharkport(const QString& path) {
|
|||
GBASavedataImportSharkPort(static_cast<GBA*>(m_threadContext.core->board), vf, false);
|
||||
threadContinue();
|
||||
vf->close(vf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GameController::exportSharkport(const QString& path) {
|
||||
if (!isLoaded()) {
|
||||
return;
|
||||
}
|
||||
#ifdef M_CORE_GBA
|
||||
if (platform() != PLATFORM_GBA) {
|
||||
return;
|
||||
}
|
||||
VFile* vf = VFileDevice::open(path, O_WRONLY | O_CREAT | O_TRUNC);
|
||||
if (!vf) {
|
||||
LOG(QT, ERROR) << tr("Failed to open snapshot file for writing: %1").arg(path);
|
||||
|
@ -527,6 +541,7 @@ void GameController::exportSharkport(const QString& path) {
|
|||
GBASavedataExportSharkPort(static_cast<GBA*>(m_threadContext.core->board), vf);
|
||||
threadContinue();
|
||||
vf->close(vf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GameController::closeGame() {
|
||||
|
@ -818,6 +833,7 @@ void GameController::setVideoLayerEnabled(int layer, bool enable) {
|
|||
return;
|
||||
}
|
||||
m_videoLayers[layer] = enable;
|
||||
#ifdef M_CORE_GBA
|
||||
if (isLoaded() && m_threadContext.core->platform(m_threadContext.core) == PLATFORM_GBA) {
|
||||
GBA* gba = static_cast<GBA*>(m_threadContext.core->board);
|
||||
switch (layer) {
|
||||
|
@ -832,6 +848,7 @@ void GameController::setVideoLayerEnabled(int layer, bool enable) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GameController::setFPSTarget(float fps) {
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
|
||||
extern "C" {
|
||||
#include "core/core.h"
|
||||
#ifdef M_CORE_GBA
|
||||
#include "gba/extra/export.h"
|
||||
#include "util/export.h"
|
||||
#ifdef M_CORE_GA
|
||||
#include "gba/gba.h"
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
#include "gb/gb.h"
|
||||
|
@ -148,9 +149,9 @@ void PaletteView::exportPalette(int start, int length) {
|
|||
}
|
||||
QString filter = dialog->selectedNameFilter();
|
||||
if (filter.contains("*.pal")) {
|
||||
GBAExportPaletteRIFF(vf, length, &static_cast<GBA*>(m_controller->thread()->core->board)->video.palette[start]);
|
||||
exportPaletteRIFF(vf, length, &static_cast<GBA*>(m_controller->thread()->core->board)->video.palette[start]);
|
||||
} else if (filter.contains("*.act")) {
|
||||
GBAExportPaletteACT(vf, length, &static_cast<GBA*>(m_controller->thread()->core->board)->video.palette[start]);
|
||||
exportPaletteACT(vf, length, &static_cast<GBA*>(m_controller->thread()->core->board)->video.palette[start]);
|
||||
}
|
||||
vf->close(vf);
|
||||
m_controller->threadContinue();
|
||||
|
|
|
@ -690,9 +690,11 @@ void Window::gameStarted(mCoreThread* context, const QString& fname) {
|
|||
foreach (QAction* action, m_gameActions) {
|
||||
action->setDisabled(false);
|
||||
}
|
||||
#ifdef M_CORE_GBA
|
||||
foreach (QAction* action, m_gbaActions) {
|
||||
action->setDisabled(context->core->platform(context->core) != PLATFORM_GBA);
|
||||
}
|
||||
#endif
|
||||
multiplayerChanged();
|
||||
if (!fname.isEmpty()) {
|
||||
setWindowFilePath(fname);
|
||||
|
@ -716,9 +718,11 @@ void Window::gameStarted(mCoreThread* context, const QString& fname) {
|
|||
}
|
||||
|
||||
void Window::gameStopped() {
|
||||
#ifdef M_CORE_GBA
|
||||
foreach (QAction* action, m_gbaActions) {
|
||||
action->setDisabled(false);
|
||||
}
|
||||
#endif
|
||||
foreach (QAction* action, m_gameActions) {
|
||||
action->setDisabled(true);
|
||||
}
|
||||
|
@ -979,6 +983,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
addControlledAction(quickSaveMenu, quickSave, QString("quickSave.%1").arg(i));
|
||||
}
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
fileMenu->addSeparator();
|
||||
QAction* importShark = new QAction(tr("Import GameShark Save"), fileMenu);
|
||||
connect(importShark, SIGNAL(triggered()), this, SLOT(importSharkport()));
|
||||
|
@ -991,6 +996,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
m_gameActions.append(exportShark);
|
||||
m_gbaActions.append(exportShark);
|
||||
addControlledAction(fileMenu, exportShark, "exportShark");
|
||||
#endif
|
||||
|
||||
fileMenu->addSeparator();
|
||||
QAction* multiWindow = new QAction(tr("New multiplayer window"), fileMenu);
|
||||
|
@ -1024,11 +1030,13 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
m_gameActions.append(shutdown);
|
||||
addControlledAction(emulationMenu, shutdown, "shutdown");
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
QAction* yank = new QAction(tr("Yank game pak"), emulationMenu);
|
||||
connect(yank, SIGNAL(triggered()), m_controller, SLOT(yankPak()));
|
||||
m_gameActions.append(yank);
|
||||
m_gbaActions.append(yank);
|
||||
addControlledAction(emulationMenu, yank, "yank");
|
||||
#endif
|
||||
emulationMenu->addSeparator();
|
||||
|
||||
QAction* pause = new QAction(tr("&Pause"), emulationMenu);
|
||||
|
@ -1299,10 +1307,12 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
connect(viewLogs, SIGNAL(triggered()), m_logView, SLOT(show()));
|
||||
addControlledAction(toolsMenu, viewLogs, "viewLogs");
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
QAction* overrides = new QAction(tr("Game &overrides..."), toolsMenu);
|
||||
connect(overrides, SIGNAL(triggered()), this, SLOT(openOverrideWindow()));
|
||||
m_gbaActions.append(overrides);
|
||||
addControlledAction(toolsMenu, overrides, "overrideWindow");
|
||||
#endif
|
||||
|
||||
QAction* sensors = new QAction(tr("Game &Pak sensors..."), toolsMenu);
|
||||
connect(sensors, SIGNAL(triggered()), this, SLOT(openSensorWindow()));
|
||||
|
@ -1331,22 +1341,26 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
m_gameActions.append(paletteView);
|
||||
addControlledAction(toolsMenu, paletteView, "paletteWindow");
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
QAction* tileView = new QAction(tr("View &tiles..."), toolsMenu);
|
||||
connect(tileView, SIGNAL(triggered()), this, SLOT(openTileWindow()));
|
||||
m_gameActions.append(tileView);
|
||||
m_gbaActions.append(tileView);
|
||||
addControlledAction(toolsMenu, tileView, "tileWindow");
|
||||
#endif
|
||||
|
||||
QAction* memoryView = new QAction(tr("View memory..."), toolsMenu);
|
||||
connect(memoryView, SIGNAL(triggered()), this, SLOT(openMemoryWindow()));
|
||||
m_gameActions.append(memoryView);
|
||||
addControlledAction(toolsMenu, memoryView, "memoryView");
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
QAction* ioViewer = new QAction(tr("View &I/O registers..."), toolsMenu);
|
||||
connect(ioViewer, SIGNAL(triggered()), this, SLOT(openIOViewer()));
|
||||
m_gameActions.append(ioViewer);
|
||||
m_gbaActions.append(ioViewer);
|
||||
addControlledAction(toolsMenu, ioViewer, "ioViewer");
|
||||
#endif
|
||||
|
||||
ConfigOption* skipBios = m_config->addOption("skipBios");
|
||||
skipBios->connect([this](const QVariant& value) {
|
||||
|
|
|
@ -156,7 +156,9 @@ private:
|
|||
// TODO: Move these to a new class
|
||||
QList<QAction*> m_gameActions;
|
||||
QList<QAction*> m_nonMpActions;
|
||||
#ifdef M_CORE_GBA
|
||||
QList<QAction*> m_gbaActions;
|
||||
#endif
|
||||
QMap<int, QAction*> m_frameSizes;
|
||||
LogController m_log;
|
||||
LogView* m_logView;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "gba/video.h"
|
||||
#include "util/vfs.h"
|
||||
|
||||
bool GBAExportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colors) {
|
||||
bool exportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colors) {
|
||||
if (entries > 0xFFFF) {
|
||||
return false;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ bool GBAExportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colo
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GBAExportPaletteACT(struct VFile* vf, size_t entries, const uint16_t* colors) {
|
||||
bool exportPaletteACT(struct VFile* vf, size_t entries, const uint16_t* colors) {
|
||||
if (entries > 256) {
|
||||
return false;
|
||||
}
|
|
@ -3,14 +3,14 @@
|
|||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef GBA_EXPORT_H
|
||||
#define GBA_EXPORT_H
|
||||
#ifndef EXPORT_H
|
||||
#define EXPORT_H
|
||||
|
||||
#include "util/common.h"
|
||||
|
||||
struct VFile;
|
||||
|
||||
bool GBAExportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colors);
|
||||
bool GBAExportPaletteACT(struct VFile* vf, size_t entries, const uint16_t* colors);
|
||||
bool exportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colors);
|
||||
bool exportPaletteACT(struct VFile* vf, size_t entries, const uint16_t* colors);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue