PSP2: Add rumble for PS TV

This commit is contained in:
Jeffrey Pfau 2016-08-08 20:59:17 -07:00
parent 33a9fad209
commit f590eb8ccf
4 changed files with 25 additions and 1 deletions

View File

@ -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:

View File

@ -154,7 +154,7 @@ int main() {
.prepareForFrame = mPSP2PrepareForFrame,
.drawFrame = mPSP2Draw,
.drawScreenshot = mPSP2DrawScreenshot,
.paused = 0,
.paused = mPSP2Paused,
.unpaused = mPSP2Unpaused,
.incrementScreenMode = mPSP2IncrementScreenMode,
.pollGameInput = mPSP2PollInput

View File

@ -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) {

View File

@ -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);