all repos — mgba @ f590eb8ccff8f2e702402cd9e9e69580581258f0

mGBA Game Boy Advance Emulator

PSP2: Add rumble for PS TV
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Aug 2016 20:59:17 -0700
commit

f590eb8ccff8f2e702402cd9e9e69580581258f0

parent

33a9fad209a3f6ef08f34b3f179746960f807f6f

M CHANGESCHANGES

@@ -43,6 +43,7 @@ - GBA Memory: Optimize stalling behavior

- 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:
M src/platform/psp2/main.csrc/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.csrc/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.hsrc/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);