mirror of https://github.com/mgba-emu/mgba.git
GBA Context: Callbacks when pausing and unpausing, for audio
This commit is contained in:
parent
1df666e91d
commit
95f6a8f8d6
|
@ -184,6 +184,9 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runner->paused) {
|
||||||
|
runner->paused(runner);
|
||||||
|
}
|
||||||
GUIInvalidateKeys(&runner->params);
|
GUIInvalidateKeys(&runner->params);
|
||||||
uint32_t keys = 0xFFFFFFFF; // Huge hack to avoid an extra variable!
|
uint32_t keys = 0xFFFFFFFF; // Huge hack to avoid an extra variable!
|
||||||
struct GUIMenuItem item;
|
struct GUIMenuItem item;
|
||||||
|
@ -219,6 +222,9 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
|
||||||
if (runner->params.guiFinish) {
|
if (runner->params.guiFinish) {
|
||||||
runner->params.guiFinish();
|
runner->params.guiFinish();
|
||||||
}
|
}
|
||||||
|
if (runner->unpaused) {
|
||||||
|
runner->unpaused(runner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GBAContextStop(&runner->context);
|
GBAContextStop(&runner->context);
|
||||||
if (runner->gameUnloaded) {
|
if (runner->gameUnloaded) {
|
||||||
|
|
|
@ -37,6 +37,8 @@ struct GBAGUIRunner {
|
||||||
void (*gameUnloaded)(struct GBAGUIRunner*);
|
void (*gameUnloaded)(struct GBAGUIRunner*);
|
||||||
void (*prepareForFrame)(struct GBAGUIRunner*);
|
void (*prepareForFrame)(struct GBAGUIRunner*);
|
||||||
void (*drawFrame)(struct GBAGUIRunner*, bool faded);
|
void (*drawFrame)(struct GBAGUIRunner*, bool faded);
|
||||||
|
void (*paused)(struct GBAGUIRunner*);
|
||||||
|
void (*unpaused)(struct GBAGUIRunner*);
|
||||||
uint16_t (*pollGameInput)(struct GBAGUIRunner*);
|
uint16_t (*pollGameInput)(struct GBAGUIRunner*);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -264,6 +264,8 @@ int main() {
|
||||||
.gameUnloaded = _gameUnloaded,
|
.gameUnloaded = _gameUnloaded,
|
||||||
.prepareForFrame = 0,
|
.prepareForFrame = 0,
|
||||||
.drawFrame = _drawFrame,
|
.drawFrame = _drawFrame,
|
||||||
|
.paused = _gameUnloaded,
|
||||||
|
.unpaused = _gameLoaded,
|
||||||
.pollGameInput = _pollGameInput
|
.pollGameInput = _pollGameInput
|
||||||
};
|
};
|
||||||
GBAGUIInit(&runner, 0);
|
GBAGUIInit(&runner, 0);
|
||||||
|
|
|
@ -170,6 +170,8 @@ int main() {
|
||||||
.gameUnloaded = _gameUnloaded,
|
.gameUnloaded = _gameUnloaded,
|
||||||
.prepareForFrame = 0,
|
.prepareForFrame = 0,
|
||||||
.drawFrame = _drawFrame,
|
.drawFrame = _drawFrame,
|
||||||
|
.paused = _gameUnloaded,
|
||||||
|
.unpaused = 0,
|
||||||
.pollGameInput = _pollGameInput
|
.pollGameInput = _pollGameInput
|
||||||
};
|
};
|
||||||
GBAGUIInit(&runner, 0);
|
GBAGUIInit(&runner, 0);
|
||||||
|
|
Loading…
Reference in New Issue