PSP2: Add rumble for PS TV
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Aug 2016 20:59:17 -0700
4 files changed,
25 insertions(+),
1 deletions(-)
M
src/platform/psp2/main.c
→
src/platform/psp2/main.c
@@ -154,7 +154,7 @@ .gameUnloaded = mPSP2UnloadROM,
.prepareForFrame = mPSP2PrepareForFrame, .drawFrame = mPSP2Draw, .drawScreenshot = mPSP2DrawScreenshot, - .paused = 0, + .paused = mPSP2Paused, .unpaused = mPSP2Unpaused, .incrementScreenMode = mPSP2IncrementScreenMode, .pollGameInput = mPSP2PollInput
M
src/platform/psp2/psp2-context.c
→
src/platform/psp2/psp2-context.c
@@ -49,6 +49,7 @@ static struct mSceRotationSource {
struct mRotationSource d; struct SceMotionSensorState state; } rotation; +static struct mRumble rumble; extern const uint8_t _binary_backdrop_png_start[]; static vita2d_texture* backdrop = 0;@@ -114,6 +115,15 @@ struct mSceRotationSource* rotation = (struct mSceRotationSource*) source;
return rotation->state.gyro.z * 0x10000000; } +static void _setRumble(struct mRumble* rumble, int enable) { + UNUSED(rumble); + struct SceCtrlActuator state = { + enable, + 0 + }; + sceCtrlSetActuator(1, &state); +} + uint16_t mPSP2PollInput(struct mGUIRunner* runner) { SceCtrlData pad; sceCtrlPeekBufferPositive(0, &pad, 1);@@ -171,6 +181,9 @@ rotation.d.readTiltY = _readTiltY;
rotation.d.readGyroZ = _readGyroZ; runner->core->setRotation(runner->core, &rotation.d); + rumble.setRumble = _setRumble; + runner->core->setRumble(runner->core, &rumble); + backdrop = vita2d_load_PNG_buffer(_binary_backdrop_png_start); unsigned mode;@@ -244,6 +257,15 @@ default:
break; } scePowerSetArmClockFrequency(80); +} + +void mPSP2Paused(struct mGUIRunner* runner) { + UNUSED(runner); + struct SceCtrlActuator state = { + 0, + 0 + }; + sceCtrlSetActuator(1, &state); } void mPSP2Unpaused(struct mGUIRunner* runner) {
M
src/platform/psp2/psp2-context.h
→
src/platform/psp2/psp2-context.h
@@ -16,6 +16,7 @@
void mPSP2LoadROM(struct mGUIRunner* runner); void mPSP2UnloadROM(struct mGUIRunner* runner); void mPSP2PrepareForFrame(struct mGUIRunner* runner); +void mPSP2Paused(struct mGUIRunner* runner); void mPSP2Unpaused(struct mGUIRunner* runner); void mPSP2Draw(struct mGUIRunner* runner, bool faded); void mPSP2DrawScreenshot(struct mGUIRunner* runner, const uint32_t* pixels, unsigned width, unsigned height, bool faded);