mirror of https://github.com/mgba-emu/mgba.git
Vita: Update to latest SDK version
This commit is contained in:
parent
380f6dbe7e
commit
b5c813e829
|
@ -22,8 +22,6 @@
|
||||||
|
|
||||||
#include <vita2d.h>
|
#include <vita2d.h>
|
||||||
|
|
||||||
PSP2_MODULE_INFO(0, 0, "mGBA");
|
|
||||||
|
|
||||||
static void _drawStart(void) {
|
static void _drawStart(void) {
|
||||||
vita2d_set_vblank_wait(false);
|
vita2d_set_vblank_wait(false);
|
||||||
vita2d_start_drawing();
|
vita2d_start_drawing();
|
||||||
|
@ -43,29 +41,29 @@ static uint32_t _pollInput(void) {
|
||||||
SceCtrlData pad;
|
SceCtrlData pad;
|
||||||
sceCtrlPeekBufferPositive(0, &pad, 1);
|
sceCtrlPeekBufferPositive(0, &pad, 1);
|
||||||
int input = 0;
|
int input = 0;
|
||||||
if (pad.buttons & PSP2_CTRL_TRIANGLE) {
|
if (pad.buttons & SCE_CTRL_TRIANGLE) {
|
||||||
input |= 1 << GUI_INPUT_CANCEL;
|
input |= 1 << GUI_INPUT_CANCEL;
|
||||||
}
|
}
|
||||||
if (pad.buttons & PSP2_CTRL_SQUARE) {
|
if (pad.buttons & SCE_CTRL_SQUARE) {
|
||||||
input |= 1 << GBA_GUI_INPUT_SCREEN_MODE;
|
input |= 1 << GBA_GUI_INPUT_SCREEN_MODE;
|
||||||
}
|
}
|
||||||
if (pad.buttons & PSP2_CTRL_CIRCLE) {
|
if (pad.buttons & SCE_CTRL_CIRCLE) {
|
||||||
input |= 1 << GUI_INPUT_BACK;
|
input |= 1 << GUI_INPUT_BACK;
|
||||||
}
|
}
|
||||||
if (pad.buttons & PSP2_CTRL_CROSS) {
|
if (pad.buttons & SCE_CTRL_CROSS) {
|
||||||
input |= 1 << GUI_INPUT_SELECT;
|
input |= 1 << GUI_INPUT_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pad.buttons & PSP2_CTRL_UP || pad.ly < 64) {
|
if (pad.buttons & SCE_CTRL_UP || pad.ly < 64) {
|
||||||
input |= 1 << GUI_INPUT_UP;
|
input |= 1 << GUI_INPUT_UP;
|
||||||
}
|
}
|
||||||
if (pad.buttons & PSP2_CTRL_DOWN || pad.ly >= 192) {
|
if (pad.buttons & SCE_CTRL_DOWN || pad.ly >= 192) {
|
||||||
input |= 1 << GUI_INPUT_DOWN;
|
input |= 1 << GUI_INPUT_DOWN;
|
||||||
}
|
}
|
||||||
if (pad.buttons & PSP2_CTRL_LEFT || pad.lx < 64) {
|
if (pad.buttons & SCE_CTRL_LEFT || pad.lx < 64) {
|
||||||
input |= 1 << GUI_INPUT_LEFT;
|
input |= 1 << GUI_INPUT_LEFT;
|
||||||
}
|
}
|
||||||
if (pad.buttons & PSP2_CTRL_RIGHT || pad.lx >= 192) {
|
if (pad.buttons & SCE_CTRL_RIGHT || pad.lx >= 192) {
|
||||||
input |= 1 << GUI_INPUT_RIGHT;
|
input |= 1 << GUI_INPUT_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void _mapVitaKey(struct GBAInputMap* map, int pspKey, enum GBAKey key) {
|
||||||
static THREAD_ENTRY _audioThread(void* context) {
|
static THREAD_ENTRY _audioThread(void* context) {
|
||||||
struct GBAPSP2AudioContext* audio = (struct GBAPSP2AudioContext*) context;
|
struct GBAPSP2AudioContext* audio = (struct GBAPSP2AudioContext*) context;
|
||||||
struct GBAStereoSample buffer[PSP2_SAMPLES];
|
struct GBAStereoSample buffer[PSP2_SAMPLES];
|
||||||
int audioPort = sceAudioOutOpenPort(PSP2_AUDIO_OUT_PORT_TYPE_MAIN, PSP2_SAMPLES, 48000, PSP2_AUDIO_OUT_MODE_STEREO);
|
int audioPort = sceAudioOutOpenPort(SCE_AUDIO_OUT_PORT_TYPE_MAIN, PSP2_SAMPLES, 48000, SCE_AUDIO_OUT_MODE_STEREO);
|
||||||
while (audio->running) {
|
while (audio->running) {
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
MutexLock(&audio->mutex);
|
MutexLock(&audio->mutex);
|
||||||
|
@ -75,7 +75,7 @@ static THREAD_ENTRY _audioThread(void* context) {
|
||||||
len = PSP2_SAMPLES;
|
len = PSP2_SAMPLES;
|
||||||
}
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
len &= ~(PSP2_AUDIO_MIN_LEN - 1);
|
len &= ~(SCE_AUDIO_MIN_LEN - 1);
|
||||||
CircleBufferRead(&audio->buffer, buffer, len * sizeof(buffer[0]));
|
CircleBufferRead(&audio->buffer, buffer, len * sizeof(buffer[0]));
|
||||||
MutexUnlock(&audio->mutex);
|
MutexUnlock(&audio->mutex);
|
||||||
sceAudioOutOutput(audioPort, buffer);
|
sceAudioOutOutput(audioPort, buffer);
|
||||||
|
@ -137,16 +137,16 @@ uint16_t GBAPSP2PollInput(struct GBAGUIRunner* runner) {
|
||||||
|
|
||||||
void GBAPSP2Setup(struct GBAGUIRunner* runner) {
|
void GBAPSP2Setup(struct GBAGUIRunner* runner) {
|
||||||
scePowerSetArmClockFrequency(80);
|
scePowerSetArmClockFrequency(80);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_CROSS, GBA_KEY_A);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_CROSS, GBA_KEY_A);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_CIRCLE, GBA_KEY_B);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_CIRCLE, GBA_KEY_B);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_START, GBA_KEY_START);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_START, GBA_KEY_START);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_SELECT, GBA_KEY_SELECT);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_SELECT, GBA_KEY_SELECT);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_UP, GBA_KEY_UP);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_UP, GBA_KEY_UP);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_DOWN, GBA_KEY_DOWN);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_DOWN, GBA_KEY_DOWN);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_LEFT, GBA_KEY_LEFT);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_LEFT, GBA_KEY_LEFT);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_RIGHT, GBA_KEY_RIGHT);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_RIGHT, GBA_KEY_RIGHT);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_LTRIGGER, GBA_KEY_L);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_LTRIGGER, GBA_KEY_L);
|
||||||
_mapVitaKey(&runner->context.inputMap, PSP2_CTRL_RTRIGGER, GBA_KEY_R);
|
_mapVitaKey(&runner->context.inputMap, SCE_CTRL_RTRIGGER, GBA_KEY_R);
|
||||||
|
|
||||||
struct GBAAxis desc = { GBA_KEY_DOWN, GBA_KEY_UP, 192, 64 };
|
struct GBAAxis desc = { GBA_KEY_DOWN, GBA_KEY_UP, 192, 64 };
|
||||||
GBAInputBindAxis(&runner->context.inputMap, PSP2_INPUT, 0, &desc);
|
GBAInputBindAxis(&runner->context.inputMap, PSP2_INPUT, 0, &desc);
|
||||||
|
|
|
@ -222,7 +222,7 @@ static const char* _vdesceName(struct VDirEntry* vde) {
|
||||||
|
|
||||||
static enum VFSType _vdesceType(struct VDirEntry* vde) {
|
static enum VFSType _vdesceType(struct VDirEntry* vde) {
|
||||||
struct VDirEntrySce* vdesce = (struct VDirEntrySce*) vde;
|
struct VDirEntrySce* vdesce = (struct VDirEntrySce*) vde;
|
||||||
if (PSP2_S_ISDIR(vdesce->ent.d_stat.st_mode)) {
|
if (SCE_S_ISDIR(vdesce->ent.d_stat.st_mode)) {
|
||||||
return VFS_DIRECTORY;
|
return VFS_DIRECTORY;
|
||||||
}
|
}
|
||||||
return VFS_FILE;
|
return VFS_FILE;
|
||||||
|
|
|
@ -40,27 +40,27 @@ struct VFile* VFileOpen(const char* path, int flags) {
|
||||||
}
|
}
|
||||||
return VFileFOpen(path, chflags);
|
return VFileFOpen(path, chflags);
|
||||||
#elif defined(PSP2)
|
#elif defined(PSP2)
|
||||||
int sceFlags = PSP2_O_RDONLY;
|
int sceFlags = SCE_O_RDONLY;
|
||||||
switch (flags & O_ACCMODE) {
|
switch (flags & O_ACCMODE) {
|
||||||
case O_WRONLY:
|
case O_WRONLY:
|
||||||
sceFlags = PSP2_O_WRONLY;
|
sceFlags = SCE_O_WRONLY;
|
||||||
break;
|
break;
|
||||||
case O_RDWR:
|
case O_RDWR:
|
||||||
sceFlags = PSP2_O_RDWR;
|
sceFlags = SCE_O_RDWR;
|
||||||
break;
|
break;
|
||||||
case O_RDONLY:
|
case O_RDONLY:
|
||||||
sceFlags = PSP2_O_RDONLY;
|
sceFlags = SCE_O_RDONLY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & O_APPEND) {
|
if (flags & O_APPEND) {
|
||||||
sceFlags |= PSP2_O_APPEND;
|
sceFlags |= SCE_O_APPEND;
|
||||||
}
|
}
|
||||||
if (flags & O_TRUNC) {
|
if (flags & O_TRUNC) {
|
||||||
sceFlags |= PSP2_O_TRUNC;
|
sceFlags |= SCE_O_TRUNC;
|
||||||
}
|
}
|
||||||
if (flags & O_CREAT) {
|
if (flags & O_CREAT) {
|
||||||
sceFlags |= PSP2_O_CREAT;
|
sceFlags |= SCE_O_CREAT;
|
||||||
}
|
}
|
||||||
return VFileOpenSce(path, sceFlags, 0666);
|
return VFileOpenSce(path, sceFlags, 0666);
|
||||||
#elif defined(USE_VFS_3DS)
|
#elif defined(USE_VFS_3DS)
|
||||||
|
|
Loading…
Reference in New Issue