Skip to content

Commit

Permalink
BACKENDS: (PSP) Use standard ScummVM virtual keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Feb 21, 2024
1 parent 22f0f63 commit 24fc450
Show file tree
Hide file tree
Showing 29 changed files with 11 additions and 723 deletions.
2 changes: 2 additions & 0 deletions backends/platform/psp/default_display_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef PSP_DEF_DISPLAY_CLIENT_H
#define PSP_DEF_DISPLAY_CLIENT_H

#include "backends/platform/psp/display_client.h"

/**
* Default display client that is useful for most purposes.
*/
Expand Down
9 changes: 1 addition & 8 deletions backends/platform/psp/display_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "backends/platform/psp/display_client.h"
#include "backends/platform/psp/default_display_client.h"
#include "backends/platform/psp/cursor.h"
#include "backends/platform/psp/pspkeyboard.h"
#include "backends/platform/psp/image_viewer.h"

#include "common/config-manager.h"
Expand Down Expand Up @@ -404,7 +403,6 @@ bool DisplayManager::renderAll() {
if (!_screen->isDirty() &&
!_overlay->isDirty() &&
!_cursor->isDirty() &&
!_keyboard->isDirty() &&
!_imageViewer->isDirty()) {
PSP_DEBUG_PRINT("Nothing dirty\n");
return true; // nothing to render
Expand All @@ -413,11 +411,10 @@ bool DisplayManager::renderAll() {
if (!isTimeToUpdate())
return false; // didn't render

PSP_DEBUG_PRINT("dirty: screen[%s], overlay[%s], cursor[%s], keyboard[%s], imageViewer[%s]\n",
PSP_DEBUG_PRINT("dirty: screen[%s], overlay[%s], cursor[%s], imageViewer[%s]\n",
_screen->isDirty() ? "true" : "false",
_overlay->isDirty() ? "true" : "false",
_cursor->isDirty() ? "true" : "false",
_keyboard->isDirty() ? "true" : "false",
_imageViewer->isDirty() ? "true" : "false"
);

Expand All @@ -438,10 +435,6 @@ bool DisplayManager::renderAll() {
_cursor->render();
_cursor->setClean();

if (_keyboard->isVisible())
_keyboard->render();
_keyboard->setClean();

_masterGuRenderer.guPostRender();

return true; // rendered successfully
Expand Down
5 changes: 1 addition & 4 deletions backends/platform/psp/display_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class MasterGuRenderer : public PspThreadable {
class Screen;
class Overlay;
class Cursor;
class PSPKeyboard;
class ImageViewer;

/**
Expand All @@ -107,7 +106,7 @@ class DisplayManager {
FIT_TO_SCREEN,
STRETCH_TO_SCREEN
};
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
DisplayManager() : _screen(0), _cursor(0), _overlay(0),
_imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
~DisplayManager();

Expand All @@ -123,7 +122,6 @@ class DisplayManager {
void setScreen(Screen *screen) { _screen = screen; }
void setCursor(Cursor *cursor) { _cursor = cursor; }
void setOverlay(Overlay *overlay) { _overlay = overlay; }
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }

void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format);
Expand All @@ -150,7 +148,6 @@ class DisplayManager {
Screen *_screen;
Cursor *_cursor;
Overlay *_overlay;
PSPKeyboard *_keyboard;
ImageViewer *_imageViewer;

MasterGuRenderer _masterGuRenderer;
Expand Down
13 changes: 2 additions & 11 deletions backends/platform/psp/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void ButtonPad::initButtonsNormalMode() {
_button[BTN_RTRIGGER][UNSHIFTED].setKey(Common::KEYCODE_INVALID, 0, Common::KBD_SHIFT);
_button[BTN_START][SHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5);
_button[BTN_START][UNSHIFTED].setKey(Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL);
_button[BTN_SELECT][UNSHIFTED].setPspEvent(PSP_EVENT_SHOW_VIRTUAL_KB, true, PSP_EVENT_NONE, 0);
_button[BTN_SELECT][UNSHIFTED].setKey(Common::KEYCODE_F7, Common::ASCII_F7, Common::KBD_CTRL);
_button[BTN_SELECT][SHIFTED].setPspEvent(PSP_EVENT_IMAGE_VIEWER, true, PSP_EVENT_NONE, 0);
}

Expand Down Expand Up @@ -449,11 +449,7 @@ bool InputHandler::getEvent(Common::Event &event, SceCtrlData &pad) {
PspEvent pspEvent;
bool haveEvent = false;

if (_keyboard->isVisible()) {
haveEvent = _keyboard->processInput(event, pspEvent, pad);
} else { // only process buttonpad if keyboard invisible
haveEvent = _buttonPad.getEvent(event, pspEvent, pad);
}
haveEvent = _buttonPad.getEvent(event, pspEvent, pad);

if (!haveEvent && pspEvent.isEmpty())
haveEvent = _nub.getEvent(event, pspEvent, pad);
Expand Down Expand Up @@ -482,11 +478,6 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
case PSP_EVENT_SHIFT:
handleShiftEvent((ShiftMode)pspEvent.data);
break;
case PSP_EVENT_SHOW_VIRTUAL_KB:
_keyboard->setVisible((bool)pspEvent.data);
if ((pspEvent.data && _keyboard->isVisible()) || !pspEvent.data) // don't change mode if keyboard didn't load
_nub.setDpadMode((bool)pspEvent.data); // set nub to keypad/regular mode
break;
case PSP_EVENT_LBUTTON:
haveEvent = true;
if (pspEvent.data) // down
Expand Down
5 changes: 1 addition & 4 deletions backends/platform/psp/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "common/scummsys.h"
#include "common/events.h"
#include "backends/platform/psp/pspkeyboard.h"
#include "backends/platform/psp/cursor.h"
#include "backends/platform/psp/image_viewer.h"
#include <pspctrl.h>
Expand Down Expand Up @@ -164,10 +163,9 @@ class Nub {

class InputHandler {
public:
InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
InputHandler() : _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
_lastPadCheckTime(0) {}
// pointer setters
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
void setCursor(Cursor *cursor) { _cursor = cursor; _nub.setCursor(cursor); }
void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }

Expand All @@ -180,7 +178,6 @@ class InputHandler {
ButtonPad _buttonPad;

// Pointers to relevant other classes
PSPKeyboard *_keyboard;
Cursor *_cursor;
ImageViewer *_imageViewer;

Expand Down
Binary file removed backends/platform/psp/kbd.zip
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys4.png
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys_c.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys_c4.png
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys_s.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys_s4.png
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys_s_c.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/keys_s_c4.png
Binary file not shown.
Binary file removed backends/platform/psp/kbd/nums.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/nums4.png
Binary file not shown.
Binary file removed backends/platform/psp/kbd/nums_s.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/nums_s4.png
Binary file not shown.
9 changes: 0 additions & 9 deletions backends/platform/psp/kbd/readme_kbd.txt

This file was deleted.

Binary file removed backends/platform/psp/kbd/syms.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/syms4.png
Binary file not shown.
Binary file removed backends/platform/psp/kbd/syms_s.xcf
Binary file not shown.
Binary file removed backends/platform/psp/kbd/syms_s4.png
Binary file not shown.
1 change: 0 additions & 1 deletion backends/platform/psp/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ MODULE_OBJS := powerman.o \
input.o \
cursor.o \
trace.o \
pspkeyboard.o \
audio.o \
thread.o \
rtc.o \
Expand Down
9 changes: 3 additions & 6 deletions backends/platform/psp/osys_psp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ void OSystem_PSP::initBackend() {
ConfMan.registerDefault("kbdmouse_speed", 3);
ConfMan.registerDefault("joystick_deadzone", 3);
ConfMan.registerDefault("gm_device", "null");

ConfMan.registerDefault("vkeybd_pack_name", "vkeybd_small");
ConfMan.set("vkeybd_pack_name", "vkeybd_small");

// Instantiate real time clock
PspRtc::instance();

Expand All @@ -75,13 +77,11 @@ void OSystem_PSP::initBackend() {
_displayManager.setCursor(&_cursor);
_displayManager.setScreen(&_screen);
_displayManager.setOverlay(&_overlay);
_displayManager.setKeyboard(&_keyboard);
_displayManager.setImageViewer(&_imageViewer);
_displayManager.init();

// Set pointers for input handler
_inputHandler.setCursor(&_cursor);
_inputHandler.setKeyboard(&_keyboard);
_inputHandler.setImageViewer(&_imageViewer);
_inputHandler.init();

Expand All @@ -93,9 +93,6 @@ void OSystem_PSP::initBackend() {

_timerManager = new PspTimerManager();

PSP_DEBUG_PRINT("calling keyboard.load()\n");
_keyboard.load(); // Load virtual keyboard files into memory

setupMixer();

EventsBaseBackend::initBackend();
Expand Down
2 changes: 0 additions & 2 deletions backends/platform/psp/osys_psp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "backends/platform/psp/display_client.h"
#include "backends/platform/psp/default_display_client.h"
#include "backends/platform/psp/cursor.h"
#include "backends/platform/psp/pspkeyboard.h"
#include "backends/platform/psp/image_viewer.h"
#include "backends/platform/psp/display_manager.h"
#include "backends/platform/psp/input.h"
Expand All @@ -51,7 +50,6 @@ class OSystem_PSP : public EventsBaseBackend, public PaletteManager {
Overlay _overlay;
Cursor _cursor;
DisplayManager _displayManager;
PSPKeyboard _keyboard;
InputHandler _inputHandler;
PspAudio _audio;
ImageViewer _imageViewer;
Expand Down
Loading

0 comments on commit 24fc450

Please sign in to comment.