mirror of https://github.com/mgba-emu/mgba.git
GBA: Add status log level
This commit is contained in:
parent
f52d91c6c8
commit
9c07698068
1
CHANGES
1
CHANGES
|
@ -45,6 +45,7 @@ Misc:
|
|||
- Qt: Handle saving input settings better
|
||||
- Debugger: Free watchpoints in addition to breakpoints
|
||||
- Qt: Move GL frame drawing back onto its own thread
|
||||
- GBA: Add status log level
|
||||
|
||||
0.2.0: (2015-04-03)
|
||||
Features:
|
||||
|
|
|
@ -530,7 +530,7 @@ void GBAHalt(struct GBA* gba) {
|
|||
|
||||
static void _GBAVLog(struct GBA* gba, enum GBALogLevel level, const char* format, va_list args) {
|
||||
struct GBAThread* threadContext = GBAThreadGetContext();
|
||||
enum GBALogLevel logLevel = -1;
|
||||
enum GBALogLevel logLevel = GBA_LOG_ALL;
|
||||
|
||||
if (gba) {
|
||||
logLevel = gba->logLevel;
|
||||
|
|
|
@ -45,8 +45,9 @@ enum GBALogLevel {
|
|||
|
||||
GBA_LOG_GAME_ERROR = 0x100,
|
||||
GBA_LOG_SWI = 0x200,
|
||||
GBA_LOG_STATUS = 0x400,
|
||||
|
||||
GBA_LOG_ALL = 0x33F,
|
||||
GBA_LOG_ALL = 0x73F,
|
||||
|
||||
#ifdef NDEBUG
|
||||
GBA_LOG_DANGER = GBA_LOG_ERROR
|
||||
|
|
|
@ -192,6 +192,9 @@ bool GBASaveState(struct GBAThread* threadContext, struct VDir* dir, int slot, b
|
|||
}
|
||||
bool success = GBASaveStateNamed(threadContext->gba, vf, screenshot);
|
||||
vf->close(vf);
|
||||
if (success) {
|
||||
GBALog(threadContext->gba, GBA_LOG_STATUS, "State %i saved", slot);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -203,6 +206,9 @@ bool GBALoadState(struct GBAThread* threadContext, struct VDir* dir, int slot) {
|
|||
threadContext->rewindBufferSize = 0;
|
||||
bool success = GBALoadStateNamed(threadContext->gba, vf);
|
||||
vf->close(vf);
|
||||
if (success) {
|
||||
GBALog(threadContext->gba, GBA_LOG_STATUS, "State %i loaded", slot);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -681,9 +681,12 @@ void GBAThreadTakeScreenshot(struct GBAThread* threadContext) {
|
|||
threadContext->gba->video.renderer->getPixels(threadContext->gba->video.renderer, &stride, &pixels);
|
||||
png_structp png = PNGWriteOpen(vf);
|
||||
png_infop info = PNGWriteHeader(png, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
|
||||
PNGWritePixels(png, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, stride, pixels);
|
||||
bool success = PNGWritePixels(png, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, stride, pixels);
|
||||
PNGWriteClose(png, info);
|
||||
vf->close(vf);
|
||||
if (success) {
|
||||
GBALog(threadContext->gba, GBA_LOG_STATUS, "Screenshot saved");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ GameController::GameController(QObject* parent)
|
|||
m_threadContext.userData = this;
|
||||
m_threadContext.rewindBufferCapacity = 0;
|
||||
m_threadContext.cheats = &m_cheatDevice;
|
||||
m_threadContext.logLevel = -1;
|
||||
m_threadContext.logLevel = GBA_LOG_ALL;
|
||||
|
||||
m_lux.p = this;
|
||||
m_lux.sample = [] (GBALuminanceSource* context) {
|
||||
|
|
|
@ -25,6 +25,7 @@ LogView::LogView(QWidget* parent)
|
|||
connect(m_ui.levelFatal, SIGNAL(toggled(bool)), this, SLOT(setLevelFatal(bool)));
|
||||
connect(m_ui.levelGameError, SIGNAL(toggled(bool)), this, SLOT(setLevelGameError(bool)));
|
||||
connect(m_ui.levelSWI, SIGNAL(toggled(bool)), this, SLOT(setLevelSWI(bool)));
|
||||
connect(m_ui.levelStatus, SIGNAL(toggled(bool)), this, SLOT(setLevelStatus(bool)));
|
||||
connect(m_ui.clear, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
connect(m_ui.maxLines, SIGNAL(valueChanged(int)), this, SLOT(setMaxLines(int)));
|
||||
m_ui.maxLines->setValue(DEFAULT_LINE_LIMIT);
|
||||
|
@ -57,6 +58,7 @@ void LogView::setLevels(int levels) {
|
|||
m_ui.levelFatal->setCheckState(levels & GBA_LOG_FATAL ? Qt::Checked : Qt::Unchecked);
|
||||
m_ui.levelGameError->setCheckState(levels & GBA_LOG_GAME_ERROR ? Qt::Checked : Qt::Unchecked);
|
||||
m_ui.levelSWI->setCheckState(levels & GBA_LOG_SWI ? Qt::Checked : Qt::Unchecked);
|
||||
m_ui.levelStatus->setCheckState(levels & GBA_LOG_STATUS ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
emit levelsSet(levels);
|
||||
}
|
||||
|
@ -125,6 +127,14 @@ void LogView::setLevelSWI(bool set) {
|
|||
}
|
||||
}
|
||||
|
||||
void LogView::setLevelStatus(bool set) {
|
||||
if (set) {
|
||||
setLevel(GBA_LOG_STATUS);
|
||||
} else {
|
||||
clearLevel(GBA_LOG_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
void LogView::setMaxLines(int limit) {
|
||||
m_lineLimit = limit;
|
||||
while (m_lines > m_lineLimit) {
|
||||
|
@ -150,6 +160,8 @@ QString LogView::toString(int level) {
|
|||
return tr("GAME ERROR");
|
||||
case GBA_LOG_SWI:
|
||||
return tr("SWI");
|
||||
case GBA_LOG_STATUS:
|
||||
return tr("STATUS");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public slots:
|
|||
void setLevelFatal(bool);
|
||||
void setLevelGameError(bool);
|
||||
void setLevelSWI(bool);
|
||||
void setLevelStatus(bool);
|
||||
|
||||
void setMaxLines(int);
|
||||
|
||||
|
|
|
@ -106,6 +106,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="levelStatus">
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue