mirror of https://github.com/mgba-emu/mgba.git
PSP2: Fix file descriptors dying on suspend (fixes #1123)
This commit is contained in:
parent
d6ff7538ee
commit
80a0263d3a
1
CHANGES
1
CHANGES
|
@ -21,6 +21,7 @@ Bugfixes:
|
||||||
- GBA: Fix video timing when skipping BIOS (fixes mgba.io/i/1318)
|
- GBA: Fix video timing when skipping BIOS (fixes mgba.io/i/1318)
|
||||||
- 3DS: Work around menu freezing (fixes mgba.io/i/1294)
|
- 3DS: Work around menu freezing (fixes mgba.io/i/1294)
|
||||||
- GBA DMA: Fix invalid DMA handling (fixes mgba.io/i/1301)
|
- GBA DMA: Fix invalid DMA handling (fixes mgba.io/i/1301)
|
||||||
|
- PSP2: Fix file descriptors dying on suspend (fixes mgba.io/i/1123)
|
||||||
Misc:
|
Misc:
|
||||||
- GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1274)
|
- GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1274)
|
||||||
- Qt: Updated Italian translation (by Vecna)
|
- Qt: Updated Italian translation (by Vecna)
|
||||||
|
|
|
@ -271,7 +271,17 @@ static void _log(struct mLogger* logger, int category, enum mLogLevel level, con
|
||||||
if (len >= sizeof(log2)) {
|
if (len >= sizeof(log2)) {
|
||||||
len = sizeof(log2) - 1;
|
len = sizeof(log2) - 1;
|
||||||
}
|
}
|
||||||
guiLogger->vf->write(guiLogger->vf, log2, len);
|
if (guiLogger->vf->write(guiLogger->vf, log2, len) < 0) {
|
||||||
|
char path[PATH_MAX];
|
||||||
|
mCoreConfigDirectory(path, PATH_MAX);
|
||||||
|
strncat(path, PATH_SEP "log", PATH_MAX - strlen(path));
|
||||||
|
guiLogger->vf->close(guiLogger->vf);
|
||||||
|
guiLogger->vf = VFileOpen(path, O_CREAT | O_WRONLY | O_APPEND);
|
||||||
|
if (guiLogger->vf->write(guiLogger->vf, log2, len) < 0) {
|
||||||
|
guiLogger->vf->close(guiLogger->vf);
|
||||||
|
guiLogger->vf = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
||||||
|
|
|
@ -160,7 +160,8 @@ int main() {
|
||||||
.unpaused = mPSP2Unpaused,
|
.unpaused = mPSP2Unpaused,
|
||||||
.incrementScreenMode = mPSP2IncrementScreenMode,
|
.incrementScreenMode = mPSP2IncrementScreenMode,
|
||||||
.setFrameLimiter = mPSP2SetFrameLimiter,
|
.setFrameLimiter = mPSP2SetFrameLimiter,
|
||||||
.pollGameInput = mPSP2PollInput
|
.pollGameInput = mPSP2PollInput,
|
||||||
|
.running = mPSP2SystemPoll
|
||||||
};
|
};
|
||||||
|
|
||||||
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
|
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <mgba-util/vfs.h>
|
#include <mgba-util/vfs.h>
|
||||||
#include <mgba-util/platform/psp2/sce-vfs.h>
|
#include <mgba-util/platform/psp2/sce-vfs.h>
|
||||||
|
|
||||||
|
#include <psp2/appmgr.h>
|
||||||
#include <psp2/audioout.h>
|
#include <psp2/audioout.h>
|
||||||
#include <psp2/camera.h>
|
#include <psp2/camera.h>
|
||||||
#include <psp2/ctrl.h>
|
#include <psp2/ctrl.h>
|
||||||
|
@ -38,6 +39,9 @@
|
||||||
#define RUMBLE_PWM 8
|
#define RUMBLE_PWM 8
|
||||||
#define CDRAM_ALIGN 0x40000
|
#define CDRAM_ALIGN 0x40000
|
||||||
|
|
||||||
|
mLOG_DECLARE_CATEGORY(GUI_PSP2);
|
||||||
|
mLOG_DEFINE_CATEGORY(GUI_PSP2, "Vita", "gui.psp2");
|
||||||
|
|
||||||
static enum ScreenMode {
|
static enum ScreenMode {
|
||||||
SM_BACKDROP,
|
SM_BACKDROP,
|
||||||
SM_PLAIN,
|
SM_PLAIN,
|
||||||
|
@ -539,6 +543,18 @@ void mPSP2IncrementScreenMode(struct mGUIRunner* runner) {
|
||||||
mCoreConfigSetUIntValue(&runner->config, "screenMode", screenMode);
|
mCoreConfigSetUIntValue(&runner->config, "screenMode", screenMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mPSP2SystemPoll(struct mGUIRunner* runner) {
|
||||||
|
SceAppMgrSystemEvent event;
|
||||||
|
if (sceAppMgrReceiveSystemEvent(&event) < 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (event.systemEvent == SCE_APPMGR_SYSTEMEVENT_ON_RESUME) {
|
||||||
|
mLOG(GUI_PSP2, INFO, "Suspend detected, reloading save");
|
||||||
|
mCoreAutoloadSave(runner->core);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__((noreturn, weak)) void __assert_func(const char* file, int line, const char* func, const char* expr) {
|
__attribute__((noreturn, weak)) void __assert_func(const char* file, int line, const char* func, const char* expr) {
|
||||||
printf("ASSERT FAILED: %s in %s at %s:%i\n", expr, func, file, line);
|
printf("ASSERT FAILED: %s in %s at %s:%i\n", expr, func, file, line);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -25,5 +25,6 @@ void mPSP2DrawScreenshot(struct mGUIRunner* runner, const color_t* pixels, unsig
|
||||||
void mPSP2IncrementScreenMode(struct mGUIRunner* runner);
|
void mPSP2IncrementScreenMode(struct mGUIRunner* runner);
|
||||||
void mPSP2SetFrameLimiter(struct mGUIRunner* runner, bool limit);
|
void mPSP2SetFrameLimiter(struct mGUIRunner* runner, bool limit);
|
||||||
uint16_t mPSP2PollInput(struct mGUIRunner* runner);
|
uint16_t mPSP2PollInput(struct mGUIRunner* runner);
|
||||||
|
bool mPSP2SystemPoll(struct mGUIRunner* runner);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue