diff --git a/CHANGES b/CHANGES index 2dbf3f4a6..489e7cfd4 100644 --- a/CHANGES +++ b/CHANGES @@ -43,6 +43,7 @@ Misc: - 3DS: Attempt to use Core 2 for threads - GUI: Screenshot dimensions are now passed through - GUI: Add back logging + - PSP2: Add rumble for PS TV 0.4.1: (2016-07-11) Bugfixes: diff --git a/src/platform/psp2/main.c b/src/platform/psp2/main.c index b6f034e66..8c95d1c88 100644 --- a/src/platform/psp2/main.c +++ b/src/platform/psp2/main.c @@ -154,7 +154,7 @@ int main() { .prepareForFrame = mPSP2PrepareForFrame, .drawFrame = mPSP2Draw, .drawScreenshot = mPSP2DrawScreenshot, - .paused = 0, + .paused = mPSP2Paused, .unpaused = mPSP2Unpaused, .incrementScreenMode = mPSP2IncrementScreenMode, .pollGameInput = mPSP2PollInput diff --git a/src/platform/psp2/psp2-context.c b/src/platform/psp2/psp2-context.c index 68d8fc91e..1dc2fb1da 100644 --- a/src/platform/psp2/psp2-context.c +++ b/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 @@ static int32_t _readGyroZ(struct mRotationSource* 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 @@ void mPSP2Setup(struct mGUIRunner* runner) { 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; @@ -246,6 +259,15 @@ void mPSP2UnloadROM(struct mGUIRunner* runner) { scePowerSetArmClockFrequency(80); } +void mPSP2Paused(struct mGUIRunner* runner) { + UNUSED(runner); + struct SceCtrlActuator state = { + 0, + 0 + }; + sceCtrlSetActuator(1, &state); +} + void mPSP2Unpaused(struct mGUIRunner* runner) { unsigned mode; if (mCoreConfigGetUIntValue(&runner->core->config, "screenMode", &mode) && mode != screenMode) { diff --git a/src/platform/psp2/psp2-context.h b/src/platform/psp2/psp2-context.h index 6a59bd1f0..5a7922fe7 100644 --- a/src/platform/psp2/psp2-context.h +++ b/src/platform/psp2/psp2-context.h @@ -16,6 +16,7 @@ void mPSP2Teardown(struct mGUIRunner* runner); 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);