all repos — mgba @ 997ba3572b0fd15ec5f0f5575720dec77c1904c8

mGBA Game Boy Advance Emulator

PSP2: Minor touchups
Vicki Pfau vi@endrift.com
Thu, 20 Apr 2017 01:41:43 -0700
commit

997ba3572b0fd15ec5f0f5575720dec77c1904c8

parent

f116713f2eb6303f8efef8370b033efd3c97e23a

2 files changed, 8 insertions(+), 9 deletions(-)

jump to
M src/platform/psp2/main.csrc/platform/psp2/main.c

@@ -163,6 +163,7 @@ mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_LEFT, GUI_INPUT_LEFT);

mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_RIGHT, GUI_INPUT_RIGHT); mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_SQUARE, mGUI_INPUT_SCREEN_MODE); + scePowerSetArmClockFrequency(444); mGUIRunloop(&runner); vita2d_fini();
M src/platform/psp2/psp2-context.csrc/platform/psp2/psp2-context.c

@@ -20,6 +20,7 @@ #include <mgba/internal/gba/input.h>

#include <mgba-util/memory.h> #include <mgba-util/circle-buffer.h> +#include <mgba-util/math.h> #include <mgba-util/ring-fifo.h> #include <mgba-util/threading.h> #include <mgba-util/vfs.h>

@@ -31,7 +32,6 @@ #include <psp2/display.h>

#include <psp2/gxm.h> #include <psp2/kernel/sysmem.h> #include <psp2/motion.h> -#include <psp2/power.h> #include <vita2d.h>

@@ -63,8 +63,8 @@

extern const uint8_t _binary_backdrop_png_start[]; static vita2d_texture* backdrop = 0; -#define PSP2_SAMPLES 128 -#define PSP2_AUDIO_BUFFER_SIZE (PSP2_SAMPLES * 40) +#define PSP2_SAMPLES 256 +#define PSP2_AUDIO_BUFFER_SIZE (PSP2_SAMPLES * 20) static struct mPSP2AudioContext { struct RingFIFO buffer;

@@ -176,7 +176,6 @@ void mPSP2Setup(struct mGUIRunner* runner) {

mCoreConfigSetDefaultIntValue(&runner->config, "threadedVideo", 1); mCoreLoadForeignConfig(runner->core, &runner->config); - scePowerSetArmClockFrequency(333); mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_CROSS, GBA_KEY_A); mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_CIRCLE, GBA_KEY_B); mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_START, GBA_KEY_START);

@@ -193,8 +192,10 @@ mInputBindAxis(&runner->core->inputMap, PSP2_INPUT, 0, &desc);

desc = (struct mInputAxis) { GBA_KEY_RIGHT, GBA_KEY_LEFT, 192, 64 }; mInputBindAxis(&runner->core->inputMap, PSP2_INPUT, 1, &desc); - tex = vita2d_create_empty_texture_format(256, 256, SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1BGR); - screenshot = vita2d_create_empty_texture_format(256, 256, SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1BGR); + unsigned width, height; + runner->core->desiredVideoDimensions(runner->core, &width, &height); + tex = vita2d_create_empty_texture_format(256, toPow2(height), SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1BGR); + screenshot = vita2d_create_empty_texture_format(256, toPow2(height), SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1BGR); outputBuffer = vita2d_texture_get_datap(tex); runner->core->setVideoBuffer(runner->core, outputBuffer, 256);

@@ -219,7 +220,6 @@ }

} void mPSP2LoadROM(struct mGUIRunner* runner) { - scePowerSetArmClockFrequency(444); float rate = 60.0f / 1.001f; sceDisplayGetRefreshRate(&rate); double ratio = GBAAudioCalculateRatio(1, rate, 1);

@@ -262,7 +262,6 @@ blip_clear(runner->core->getAudioChannel(runner->core, 0));

blip_clear(runner->core->getAudioChannel(runner->core, 1)); break; } - sceKernelDelayThread(400); } blip_read_samples(runner->core->getAudioChannel(runner->core, 0), &samples[0].left, PSP2_SAMPLES, true); blip_read_samples(runner->core->getAudioChannel(runner->core, 1), &samples[0].right, PSP2_SAMPLES, true);

@@ -297,7 +296,6 @@ #endif

default: break; } - scePowerSetArmClockFrequency(333); } void mPSP2Paused(struct mGUIRunner* runner) {