mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
PSP/PS3/Wii/GameCube/Xbox: Add virtual keyboard support to launcher
This commit is contained in:
parent
8bd5e66f46
commit
fe221b1098
@ -229,6 +229,7 @@ static void VirtualKeyboard_Open(struct OpenKeyboardArgs* args, cc_bool launcher
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void VirtualKeyboard_SetText(const cc_string* text) {
|
static void VirtualKeyboard_SetText(const cc_string* text) {
|
||||||
|
if (!kb_showing) return;
|
||||||
String_Copy(&kb_str, text);
|
String_Copy(&kb_str, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,11 +260,11 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
||||||
|
if (kb_showing) VirtualKeyboard_Display2D(&r, bmp);
|
||||||
// TODO: double buffering ??
|
// TODO: double buffering ??
|
||||||
// https://dcemulation.org/phpBB/viewtopic.php?t=99999
|
// https://dcemulation.org/phpBB/viewtopic.php?t=99999
|
||||||
// https://dcemulation.org/phpBB/viewtopic.php?t=43214
|
// https://dcemulation.org/phpBB/viewtopic.php?t=43214
|
||||||
vid_waitvbl();
|
vid_waitvbl();
|
||||||
if (kb_showing) VirtualKeyboard_Display2D(&r, bmp);
|
|
||||||
|
|
||||||
for (int y = r.y; y < r.y + r.height; y++)
|
for (int y = r.y; y < r.y + r.height; y++)
|
||||||
{
|
{
|
||||||
@ -294,12 +294,10 @@ void Window_OpenKeyboard(struct OpenKeyboardArgs* args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window_SetKeyboardText(const cc_string* text) {
|
void Window_SetKeyboardText(const cc_string* text) {
|
||||||
if (!kb_showing) return;
|
|
||||||
VirtualKeyboard_SetText(text);
|
VirtualKeyboard_SetText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_CloseKeyboard(void) {
|
void Window_CloseKeyboard(void) {
|
||||||
if (Input.Sources & INPUT_SOURCE_NORMAL) return;
|
|
||||||
VirtualKeyboard_Close();
|
VirtualKeyboard_Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#if defined HW_RVL
|
#if defined HW_RVL
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
@ -446,6 +447,7 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
|||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
needsFBUpdate = false;
|
needsFBUpdate = false;
|
||||||
}
|
}
|
||||||
|
if (kb_showing) VirtualKeyboard_Display2D(&r, bmp);
|
||||||
|
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
r.x &= ~0x01; // round down to nearest even horizontal index
|
r.x &= ~0x01; // round down to nearest even horizontal index
|
||||||
@ -471,6 +473,23 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*########################################################################################################################*
|
||||||
|
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
||||||
|
*#########################################################################################################################*/
|
||||||
|
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) {
|
||||||
|
if (Input.Sources & INPUT_SOURCE_NORMAL) return;
|
||||||
|
VirtualKeyboard_Open(args, launcherMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_SetKeyboardText(const cc_string* text) {
|
||||||
|
VirtualKeyboard_SetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_CloseKeyboard(void) {
|
||||||
|
VirtualKeyboard_Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Misc/Other--------------------------------------------------------*
|
*-------------------------------------------------------Misc/Other--------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
@ -487,10 +506,6 @@ void Window_Show(void) { }
|
|||||||
void Window_SetSize(int width, int height) { }
|
void Window_SetSize(int width, int height) { }
|
||||||
|
|
||||||
|
|
||||||
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) { /* TODO implement */ }
|
|
||||||
void Window_SetKeyboardText(const cc_string* text) { }
|
|
||||||
void Window_CloseKeyboard(void) { /* TODO implement */ }
|
|
||||||
|
|
||||||
void Window_ShowDialog(const char* title, const char* msg) {
|
void Window_ShowDialog(const char* title, const char* msg) {
|
||||||
/* TODO implement */
|
/* TODO implement */
|
||||||
Platform_LogConst(title);
|
Platform_LogConst(title);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#include <io/pad.h>
|
#include <io/pad.h>
|
||||||
#include <io/kb.h>
|
#include <io/kb.h>
|
||||||
#include <sysutil/sysutil.h>
|
#include <sysutil/sysutil.h>
|
||||||
@ -236,6 +237,17 @@ static void ProcessKBTextInput(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ProcessKBInput(void) {
|
||||||
|
int res = ioKbRead(0, &kb_data);
|
||||||
|
Input.Sources |= INPUT_SOURCE_NORMAL;
|
||||||
|
|
||||||
|
if (res == 0 && kb_data.nb_keycode > 0) {
|
||||||
|
ProcessKBButtons();
|
||||||
|
ProcessKBModifiers(&kb_data.mkey);
|
||||||
|
ProcessKBTextInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*----------------------------------------------------Input processing-----------------------------------------------------*
|
*----------------------------------------------------Input processing-----------------------------------------------------*
|
||||||
@ -284,16 +296,8 @@ void Window_ProcessEvents(double delta) {
|
|||||||
ProcessPadInput(delta, &pad_data);
|
ProcessPadInput(delta, &pad_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO set InputSource keyboard
|
|
||||||
ioKbGetInfo(&kb_info);
|
ioKbGetInfo(&kb_info);
|
||||||
if (kb_info.status[0]) {
|
if (kb_info.status[0]) ProcessKBInput();
|
||||||
int res = ioKbRead(0, &kb_data);
|
|
||||||
if (res == 0 && kb_data.nb_keycode > 0) {
|
|
||||||
ProcessKBButtons();
|
|
||||||
ProcessKBModifiers(&kb_data.mkey);
|
|
||||||
ProcessKBTextInput();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor_SetPosition(int x, int y) { } // Makes no sense for PS Vita
|
void Cursor_SetPosition(int x, int y) { } // Makes no sense for PS Vita
|
||||||
@ -319,6 +323,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
||||||
|
if (kb_showing) VirtualKeyboard_Display2D(&r, bmp);
|
||||||
// TODO test
|
// TODO test
|
||||||
Gfx_BeginFrame();
|
Gfx_BeginFrame();
|
||||||
Gfx_ClearBuffers(GFX_BUFFER_COLOR | GFX_BUFFER_DEPTH);
|
Gfx_ClearBuffers(GFX_BUFFER_COLOR | GFX_BUFFER_DEPTH);
|
||||||
@ -336,9 +341,18 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) { /* TODO implement */ }
|
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) {
|
||||||
void Window_SetKeyboardText(const cc_string* text) { }
|
if (Input.Sources & INPUT_SOURCE_NORMAL) return;
|
||||||
void Window_CloseKeyboard(void) { /* TODO implement */ }
|
VirtualKeyboard_Open(args, launcherMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_SetKeyboardText(const cc_string* text) {
|
||||||
|
VirtualKeyboard_SetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_CloseKeyboard(void) {
|
||||||
|
VirtualKeyboard_Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#include <pspdisplay.h>
|
#include <pspdisplay.h>
|
||||||
#include <pspge.h>
|
#include <pspge.h>
|
||||||
#include <pspctrl.h>
|
#include <pspctrl.h>
|
||||||
@ -120,6 +121,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
||||||
|
if (kb_showing) VirtualKeyboard_Display2D(&r, bmp);
|
||||||
void* fb = sceGeEdramGetAddr();
|
void* fb = sceGeEdramGetAddr();
|
||||||
|
|
||||||
sceDisplayWaitVblankStart();
|
sceDisplayWaitVblankStart();
|
||||||
@ -143,9 +145,18 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) { /* TODO implement */ }
|
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) {
|
||||||
void Window_SetKeyboardText(const cc_string* text) { }
|
if (Input.Sources & INPUT_SOURCE_NORMAL) return;
|
||||||
void Window_CloseKeyboard(void) { /* TODO implement */ }
|
VirtualKeyboard_Open(args, launcherMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_SetKeyboardText(const cc_string* text) {
|
||||||
|
VirtualKeyboard_SetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_CloseKeyboard(void) {
|
||||||
|
VirtualKeyboard_Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#include <hal/video.h>
|
#include <hal/video.h>
|
||||||
#include <usbh_lib.h>
|
#include <usbh_lib.h>
|
||||||
#include <xid_driver.h>
|
#include <xid_driver.h>
|
||||||
@ -174,6 +175,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
|||||||
|
|
||||||
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
||||||
void* fb = XVideoGetFB();
|
void* fb = XVideoGetFB();
|
||||||
|
if (kb_showing) VirtualKeyboard_Display2D(&r, bmp);
|
||||||
//XVideoWaitForVBlank();
|
//XVideoWaitForVBlank();
|
||||||
// XVideoWaitForVBlank installs an interrupt handler for VBlank -
|
// XVideoWaitForVBlank installs an interrupt handler for VBlank -
|
||||||
// however this will cause pbkit's attempt to install an interrupt
|
// however this will cause pbkit's attempt to install an interrupt
|
||||||
@ -196,9 +198,18 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) { }
|
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) {
|
||||||
void Window_SetKeyboardText(const cc_string* text) { }
|
if (Input.Sources & INPUT_SOURCE_NORMAL) return;
|
||||||
void Window_CloseKeyboard(void) { /* TODO implement */ }
|
VirtualKeyboard_Open(args, launcherMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_SetKeyboardText(const cc_string* text) {
|
||||||
|
VirtualKeyboard_SetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window_CloseKeyboard(void) {
|
||||||
|
VirtualKeyboard_Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user