Skip to content

Commit

Permalink
PSV: ime update
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Oct 22, 2024
1 parent bd8b541 commit f52043d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ jobs:
-DUSE_SYSTEM_CURL=ON \
-DUSE_SYSTEM_SDL2=ON \
-DMPV_NO_FB=ON \
-DSIMPLE_HIGHLIGHT=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBRLS_UNITY_BUILD=${{ github.event.inputs.disable_unity_build == 'true' && 'OFF' || 'ON' }} \
-DCMAKE_UNITY_BUILD_BATCH_SIZE=16 \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ hbmenu 自行选择路径。

下载 `wiliwili-PSVita.vpk` 安装即可:[wiliwili releases](https://github.com/xfangfang/wiliwili/releases)

目前只推荐观看 360P 分辨率使用,不过仍有相当大的提升空间,如果你愿意为此贡献欢迎开一个 PR 讨论了解更多。
开启硬解后可以流畅播放 480P 视频,仍有相当大的提升空间,如果你愿意为此贡献欢迎开一个 PR 讨论了解更多。

### PS4

Expand Down
2 changes: 1 addition & 1 deletion library/borealis
27 changes: 10 additions & 17 deletions scripts/psv/sdl2/ime.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index 9e823996e..d5c11e6a1 100644
index 9e823996e..6a15b84e6 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -400,10 +400,10 @@ SDL_bool VITA_HasScreenKeyboardSupport(_THIS)
Expand All @@ -15,7 +15,7 @@ index 9e823996e..d5c11e6a1 100644
if (!(src[i] & 0xFF80)) {
*(dst++) = src[i] & 0xFF;
} else if (!(src[i] & 0xF800)) {
@@ -425,44 +425,90 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst)
@@ -425,36 +425,75 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst)
*dst = '\0';
}

Expand Down Expand Up @@ -81,11 +81,11 @@ index 9e823996e..d5c11e6a1 100644
+
+ // Update text
+ if (e->param.text.editLengthChange < 0) {
+ SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_DELETE);
+ SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_BACKSPACE);
+ } else if (e->param.text.editLengthChange > 0) {
+ _utf16_to_utf8(&e->param.text.str[e->param.text.editIndex], utf8_buffer, e->param.text.editLengthChange);
+ SDL_SendKeyboardText((const char *)utf8_buffer);
}
+ }
+
+ // Update preedit text
+ if (e->param.text.preeditLength == 0) {
Expand All @@ -94,24 +94,20 @@ index 9e823996e..d5c11e6a1 100644
+ } else {
+ _utf16_to_utf8(&e->param.text.str[e->param.text.preeditIndex], utf8_buffer, e->param.text.preeditLength);
+ SDL_SendEditingText((const char *)utf8_buffer, 0, SDL_strlen((const char *)utf8_buffer));
+ }
+ break;
}
break;
+ case SCE_IME_EVENT_UPDATE_CARET:
+ if (e->param.caretIndex < caret_index) {
+ SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_LEFT);
+ } else {
+ SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_RIGHT);
+ }
+ caret_index = e->param.caretIndex;
break;
+ break;
case SCE_IME_EVENT_PRESS_ENTER:
SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_RETURN);
case SCE_IME_EVENT_PRESS_CLOSE:
sceImeClose();
videodata->ime_active = SDL_FALSE;
+ vita_ime_init_text = NULL;
+ vita_ime_max_text = 32;
+ vita_ime_type = 0;
@@ -463,6 +502,10 @@ void VITA_ImeEventHandler(void *arg, const SceImeEventData *e)
break;
}
}
Expand All @@ -122,7 +118,7 @@ index 9e823996e..d5c11e6a1 100644
#endif

void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
@@ -478,16 +524,22 @@ void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
@@ -478,16 +521,22 @@ void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
sceImeParamInit(&param);

SDL_memset(libime_out, 0, ((SCE_IME_MAX_PREEDIT_LENGTH + SCE_IME_MAX_TEXT_LENGTH + 1) * sizeof(SceWChar16)));
Expand Down Expand Up @@ -150,17 +146,14 @@ index 9e823996e..d5c11e6a1 100644
param.arg = videodata;
param.work = libime_work;

@@ -544,6 +596,13 @@ void VITA_HideScreenKeyboard(_THIS, SDL_Window *window)
@@ -544,6 +593,10 @@ void VITA_HideScreenKeyboard(_THIS, SDL_Window *window)
}

videodata->ime_active = SDL_FALSE;
+#else
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ videodata->ime_active = SDL_FALSE;
+ sceImeClose();
+ vita_ime_init_text = NULL;
+ vita_ime_max_text = 32;
+ vita_ime_type = 0;
#endif
}

0 comments on commit f52043d

Please sign in to comment.