From 5472e7098adfab3ebd5e9b59f2391ebcf316435c Mon Sep 17 00:00:00 2001 From: GrapheneCt <57592952+GrapheneCt@users.noreply.github.com> Date: Wed, 22 Dec 2021 02:11:34 +0200 Subject: [PATCH] Bugfixes --- ElevenMPV-A-libScePafPreload/prx.c | 4 ++-- ElevenMPV-A/CONTENTS/empva_plugin.rco | Bin 230304 -> 230304 bytes .../CONTENTS/module/libScePafPreload.suprx | Bin 5080 -> 5080 bytes ElevenMPV-A/include/audio/audio.h | 2 ++ ElevenMPV-A/param.sfx | 2 +- ElevenMPV-A/param_for_debug.sfx | 2 +- ElevenMPV-A/source/audio/webm_opus.cpp | 10 +++++---- ElevenMPV-A/source/audio/youtube_opus.cpp | 10 +++++---- ElevenMPV-A/source/downloader.cpp | 18 ++++++++++++++-- ElevenMPV-A/source/main.cpp | 20 ++++++++++++------ .../source/menus/menu_displayfiles.cpp | 2 +- .../menus/youtube/menu_youtube_base.cpp | 14 +++++++++--- .../source/menus/youtube/menu_youtube_fav.cpp | 2 +- .../menus/youtube/menu_youtube_history.cpp | 2 +- .../menus/youtube/menu_youtube_search.cpp | 4 ++-- ElevenMPV-A/source/utils.cpp | 1 + Resource/empva_plugin.xml | 2 +- 17 files changed, 65 insertions(+), 30 deletions(-) diff --git a/ElevenMPV-A-libScePafPreload/prx.c b/ElevenMPV-A-libScePafPreload/prx.c index aba1847..f2f51f2 100644 --- a/ElevenMPV-A-libScePafPreload/prx.c +++ b/ElevenMPV-A-libScePafPreload/prx.c @@ -40,7 +40,7 @@ int __module_start(SceSize argc, void *args) #ifdef GROW_MEMORY - init_param.global_heap_size = 4 * 1024 * 1024 + 512 * 1024; + init_param.global_heap_size = 4 * 1024 * 1024; //Grow memory if possible ret = sceAppMgrGrowMemory3(41 * 1024 * 1024, 1); // 57 MB @@ -50,7 +50,7 @@ int __module_start(SceSize argc, void *args) init_param.global_heap_size = 12 * 1024 * 1024; } else - init_param.global_heap_size = 20 * 1024 * 1024; + init_param.global_heap_size = 23 * 1024 * 1024; #else init_param.global_heap_size = 12 * 1024 * 1024; #endif diff --git a/ElevenMPV-A/CONTENTS/empva_plugin.rco b/ElevenMPV-A/CONTENTS/empva_plugin.rco index 6895bd1691cbb3adcbe7bd4a94a432c4a2fb7078..84d6ecee75e8de2fb7314e990944d4339c0d02ed 100644 GIT binary patch delta 28 icmZ3`&bOeQZ-av?BSW*JYrCT>BM>ufcXVZrw*vr(*9fEl delta 28 icmZ3`&bOeQZ-av?BV)6pYrCT>BM>ufcXVZrw*vr(=?J9& diff --git a/ElevenMPV-A/CONTENTS/module/libScePafPreload.suprx b/ElevenMPV-A/CONTENTS/module/libScePafPreload.suprx index 0e89e35cea398068ebce052652b66c785aace6c9..5cc2f2b41762b5251f4b683c9dec9a369f12ba10 100644 GIT binary patch delta 574 zcmV-E0>S;*C)g*jhyei_lZgS#Aj1BIjWs4N1eg1(G~CiV)A;1&hY}inq#NAk9b8OU zJ+pKIhz@@S2F3~TA5;n$6&XI1y&x_5AQ8T8HZ0c20$?Zh7U0>7-l+r3W4&% zUN9;!KZyUZqkwV3mFL{E6f-6|F<#`^Ah4I=gTsFdhW!Ft9X>HI9{^(GjX)L;kj2BG z{J@>z0jGk%UTm_Acx9R3vJCqf7#=*9`>+3yfnfm~M#h}Xq~PS#fW)+bqST!H z#1sYuU;_~g7#SE2KyeHc1H)P#Mh_%43>;AU2~f_48G#i*f(^_Jj0~s%XhvfW5SxHy z5VC)BKmK8^0g8jzD}eMKC>t4|>k%vY*wq77w+2Wbz^aE8NHW27JzMkg)C{P)4M6$` z5bpruGe~+TJ^4|&vdLuPw2Lv5cd01l0QEKkO=;u=Vi!h+Mqq#iR~F~yrPiB&LYEfQl4oJ>2`Ox9BZyA4Gen@AUC+$)DmA-1nWEP+qB0#JH#3n#| z0cf`a&=N*{24La<(gqB`q{YA>`}cqSh7B7UB%!n@h+e_nuolc;(Qp__--Oa1pz3}= zX@-9gngdD;0BKM-LJ&)C)g*jhyei`lZgS#AQ1)rnnhQL)uT6Km1G2`*M0Ts0l>%A;oQbA5@h>+ zTC;Qlhz@@V42%=vKd2NiDl&X1d%>V#a4Y^p1DIC;FyDF>*x5ok&yClI?ZGBg4MEV!~bH$SB`Cl#a~ z$agF#@J%m*uzfOpM8JJ=<-84(>!U9+OPCgJ0`OL%@6@%6(BYN z;tN2#9e|cF>N5Zn2aq;k046O42HC&=>o;uJ&>#t=MM3lm?uNBs{)&dfQ2Hj6{s2|? z14=XegU}pMS^!9c!XY}q(M=&BC?ZzD2N>h2MOF$16{;0n7~%>=sl}x^B`|3Q0NDe? N4A_&A0u_@G6UfVr@$3Kq diff --git a/ElevenMPV-A/include/audio/audio.h b/ElevenMPV-A/include/audio/audio.h index 39e6972..0c37724 100644 --- a/ElevenMPV-A/include/audio/audio.h +++ b/ElevenMPV-A/include/audio/audio.h @@ -246,6 +246,7 @@ namespace audio { SceNmHandle nmHandle; SceUInt64 totalTime; SceUInt64 samplesRead; + SceUInt64 seekTargetSamples; SceUInt32 sampleRate; SceInt32 maxSamples; SceUInt8 channelNum; @@ -438,6 +439,7 @@ namespace audio { SceNmHandle nmHandle; SceUInt64 totalTime; SceUInt64 samplesRead; + SceUInt64 seekTargetSamples; SceUInt32 sampleRate; SceInt32 maxSamples; SceUInt8 channelNum; diff --git a/ElevenMPV-A/param.sfx b/ElevenMPV-A/param.sfx index 696d01a..99a2073 100644 --- a/ElevenMPV-A/param.sfx +++ b/ElevenMPV-A/param.sfx @@ -1,6 +1,6 @@ - 06.01 + 06.02 17338504 16 0 diff --git a/ElevenMPV-A/param_for_debug.sfx b/ElevenMPV-A/param_for_debug.sfx index 696d01a..99a2073 100644 --- a/ElevenMPV-A/param_for_debug.sfx +++ b/ElevenMPV-A/param_for_debug.sfx @@ -1,6 +1,6 @@ - 06.01 + 06.02 17338504 16 0 diff --git a/ElevenMPV-A/source/audio/webm_opus.cpp b/ElevenMPV-A/source/audio/webm_opus.cpp index 5396e4f..7d8fc70 100644 --- a/ElevenMPV-A/source/audio/webm_opus.cpp +++ b/ElevenMPV-A/source/audio/webm_opus.cpp @@ -73,6 +73,7 @@ audio::WebmOpusDecoder::WebmOpusDecoder(const char *path, SceBool isSwDecoderUse nestegg_audio_params aparams; samplesRead = 0; + seekTargetSamples = 0; totalTime = 0; sampleRate = 0; s_currPos = 0; @@ -191,10 +192,10 @@ SceVoid audio::WebmOpusDecoder::Decode(ScePVoid stream, SceUInt32 length, ScePVo SceUInt64 audio::WebmOpusDecoder::GetPosition() { - while (isSeeking) { - thread::Sleep(10); - } - return samplesRead; + if (isSeeking) + return seekTargetSamples; + else + return samplesRead; } SceUInt64 audio::WebmOpusDecoder::GetLength() @@ -208,6 +209,7 @@ SceUInt64 audio::WebmOpusDecoder::Seek(SceFloat32 percent) seekTime = seekTime / 10.0f; SceFloat32 seekIterNum = sce_paf_ceilf(seekTime); SceUInt64 llSeekTime = (SceInt64)(seekIterNum * 10001000000.0f); + seekTargetSamples = (SceUInt64)((SceDouble)llSeekTime * (SceDouble)sampleRate / 1000000000.0f); // This imitates length in samples LOCALMediaInvalidateAllBuffers(nmHandle); diff --git a/ElevenMPV-A/source/audio/youtube_opus.cpp b/ElevenMPV-A/source/audio/youtube_opus.cpp index b547df2..10c6ae0 100644 --- a/ElevenMPV-A/source/audio/youtube_opus.cpp +++ b/ElevenMPV-A/source/audio/youtube_opus.cpp @@ -77,6 +77,7 @@ audio::YoutubeDecoder::YoutubeDecoder(const char *path, SceBool isSwDecoderUsed) nestegg_audio_params aparams; samplesRead = 0; + seekTargetSamples = 0; totalTime = 0; sampleRate = 0; s_currPos = 0; @@ -195,10 +196,10 @@ SceVoid audio::YoutubeDecoder::Decode(ScePVoid stream, SceUInt32 length, ScePVoi SceUInt64 audio::YoutubeDecoder::GetPosition() { - while (isSeeking) { - thread::Sleep(10); - } - return samplesRead; + if (isSeeking) + return seekTargetSamples; + else + return samplesRead; } SceUInt64 audio::YoutubeDecoder::GetLength() @@ -212,6 +213,7 @@ SceUInt64 audio::YoutubeDecoder::Seek(SceFloat32 percent) seekTime = seekTime / 10.0f; SceFloat32 seekIterNum = sce_paf_ceilf(seekTime); SceUInt64 llSeekTime = (SceInt64)(seekIterNum * 10001000000.0f); + seekTargetSamples = (SceUInt64)((SceDouble)llSeekTime * (SceDouble)sampleRate / 1000000000.0f); // This imitates length in samples NETMediaInvalidateAllBuffers(nmHandle); diff --git a/ElevenMPV-A/source/downloader.cpp b/ElevenMPV-A/source/downloader.cpp index f42352c..2e67b8b 100644 --- a/ElevenMPV-A/source/downloader.cpp +++ b/ElevenMPV-A/source/downloader.cpp @@ -98,6 +98,10 @@ SceInt32 Downloader::Enqueue(const char *url, const char *name) else if (ret2 != SCE_OK) return ret2; + sceClibPrintf("name: %s\n", minfo.name); + sceClibPrintf("mime: %s\n", minfo.mimeType); + sceClibPrintf("size: %u\n", minfo.size); + sce_paf_memset(&minfo.name, 0, sizeof(minfo.name)); sce_paf_strcpy((char *)minfo.name, name); @@ -114,9 +118,19 @@ SceInt32 Downloader::Enqueue(const char *url, const char *name) bfInfo.data1 = &dwRes; bfInfo.data1Size = sizeof(SceInt32); + ret2 = SCE_OK; ret = dw.client->invokeSyncMethod(0x12340011, &dtInfo, 3, &ret2, &bfInfo, 1); - if (ret2 != SCE_OK) - return ret2; + if (ret2 != SCE_OK) { + //invalid filename? + sce_paf_memset(&minfo.name, 0, sizeof(minfo.name)); + char *ext = sce_paf_strrchr(name, '.'); + sce_paf_snprintf((char *)minfo.name, sizeof(minfo.name), "DefaultFilename%s", ext); + + ret2 = SCE_OK; + ret = dw.client->invokeSyncMethod(0x12340011, &dtInfo, 3, &ret2, &bfInfo, 1); + if (ret2 != SCE_OK) + return ret2; + } return ret; } diff --git a/ElevenMPV-A/source/main.cpp b/ElevenMPV-A/source/main.cpp index 9b7b311..34d30ae 100644 --- a/ElevenMPV-A/source/main.cpp +++ b/ElevenMPV-A/source/main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "common.h" #include "main.h" @@ -23,7 +24,9 @@ using namespace paf; extern "C" { SCE_USER_MODULE_LIST("app0:module/libScePafPreload.suprx"); - unsigned int sceLibcHeapSize = 5 * 1024 * 1024; + unsigned int sceLibcHeapSize = SCE_LIBC_HEAP_SIZE_EXTENDED_ALLOC_NO_LIMIT; + unsigned int sceLibcHeapInitialSize = 2 * 1024 * 1024; + unsigned int sceLibcHeapExtendedAlloc = 1; } SceUID g_eventFlagUid; @@ -50,6 +53,8 @@ menu::audioplayer::Audioplayer *g_currentPlayerInstance = SCE_NULL; menu::displayfiles::Page *g_currentDispFilePage; menu::settings::SettingsButtonCB *g_settingsButtonCB; +static const EMPVAUtils::MemState k_ytModeLimit = EMPVAUtils::MemState_Mid; + SceVoid menu::main::PagemodeButtonCB::PagemodeButtonCBFun(SceInt32 eventId, paf::ui::Widget *self, SceInt32 a3, ScePVoid pUserData) { Plugin::TemplateInitParam tmpParam; @@ -67,7 +72,7 @@ SceVoid menu::main::PagemodeButtonCB::PagemodeButtonCBFun(SceInt32 eventId, paf: if (currentPagemode == menu::settings::Settings::PageMode_Normal) { if (sceSysmoduleIsLoaded(SCE_SYSMODULE_HTTPS)) { - if (EMPVAUtils::GetMemStatus() > EMPVAUtils::MemState_Mid) { + if (EMPVAUtils::GetMemStatus() > k_ytModeLimit) { menu::youtube::Base::FirstTimeInit(); } } @@ -178,7 +183,7 @@ SceVoid pluginLoadCB(Plugin *plugin) SCE_DBG_LOG_DEBUG("[EMPVA_DEBUG] pagemode set to %u\n", pagemode); if (pagemode == menu::settings::Settings::PageMode_YouTube) { - if (EMPVAUtils::GetMemStatus() < EMPVAUtils::MemState_Full) { + if (EMPVAUtils::GetMemStatus() <= k_ytModeLimit) { SCE_DBG_LOG_DEBUG("[EMPVA_DEBUG] Failed to grow memory: resetting pagemode to NORMAL\n"); pagemode = menu::settings::Settings::PageMode_Normal; } @@ -186,7 +191,7 @@ SceVoid pluginLoadCB(Plugin *plugin) EMPVAUtils::SetPagemode(pagemode); - if (EMPVAUtils::GetMemStatus() > EMPVAUtils::MemState_Mid) { + if (EMPVAUtils::GetMemStatus() > k_ytModeLimit) { g_YtVitaIconTex = new graphics::Texture(); searchParam.hash = EMPVAUtils::GetHash("tex_yt_icon_vita"); Plugin::LoadTexture(g_YtVitaIconTex, g_empvaPlugin, &searchParam); @@ -240,7 +245,7 @@ SceVoid pluginLoadCB(Plugin *plugin) searchParam.hash = EMPVAUtils::GetHash("_common_texture_transparent"); Plugin::LoadTexture(g_texTransparent, Plugin::Find("__system__common_resource"), &searchParam); - if (EMPVAUtils::GetMemStatus() > EMPVAUtils::MemState_Mid) { + if (EMPVAUtils::GetMemStatus() > k_ytModeLimit) { searchParam.hash = EMPVAUtils::GetHash("yt_menu_template_corner_switch"); g_empvaPlugin->TemplateOpen(g_rootPage, &searchParam, &tmpParam); @@ -286,6 +291,7 @@ SceVoid pluginLoadCB(Plugin *plugin) auto playerButtonCB = new menu::displayfiles::PlayerButtonCB(); playerButton->RegisterEventCallback(0x10000008, playerButtonCB, 0); playerButton->PlayAnimationReverse(0.0f, ui::Widget::Animation_Reset); + playerButton->AssignButton(0x80); //square sceShellUtilUnlock(SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN); } @@ -304,11 +310,11 @@ int main() //fwParam.optionalFeatureFlags = Framework::InitParam::FeatureFlag_DisableInternalCallbackChecks; if (EMPVAUtils::GetMemStatus() == EMPVAUtils::MemState_Full) { - fwParam.defaultSurfacePoolSize = 16 * 1024 * 1024; + fwParam.defaultSurfacePoolSize = 18 * 1024 * 1024; fwParam.textSurfaceCacheSize = 2 * 1024 * 1024; } else if (EMPVAUtils::GetMemStatus() == EMPVAUtils::MemState_Mid) { - fwParam.defaultSurfacePoolSize = 11 * 1024 * 1024 + 512 * 1024; + fwParam.defaultSurfacePoolSize = 11 * 1024 * 1024; fwParam.textSurfaceCacheSize = 2 * 1024 * 1024; } else { diff --git a/ElevenMPV-A/source/menus/menu_displayfiles.cpp b/ElevenMPV-A/source/menus/menu_displayfiles.cpp index 21bb6a9..99f8ec6 100644 --- a/ElevenMPV-A/source/menus/menu_displayfiles.cpp +++ b/ElevenMPV-A/source/menus/menu_displayfiles.cpp @@ -286,7 +286,7 @@ menu::displayfiles::Page::Page(const char* path) file->button->Disable(0); file->buttonCB = new ButtonCB; file->buttonCB->pUserData = file; - file->button->RegisterEventCallback(ui::Widget::EventMain_Pressed, file->buttonCB, 0); + file->button->RegisterEventCallback(ui::Widget::EventMain_Decide, file->buttonCB, 0); if (i == fileNum - 1) lastFile = file; file = file->next; diff --git a/ElevenMPV-A/source/menus/youtube/menu_youtube_base.cpp b/ElevenMPV-A/source/menus/youtube/menu_youtube_base.cpp index 559e185..3af663e 100644 --- a/ElevenMPV-A/source/menus/youtube/menu_youtube_base.cpp +++ b/ElevenMPV-A/source/menus/youtube/menu_youtube_base.cpp @@ -341,6 +341,7 @@ SceVoid menu::youtube::Base::FirstTimeInit() Resource::Element searchParam; Plugin::TemplateInitParam tmpParam; ui::Widget *commonWidget; + ui::Widget *ytTopPlane; ui::Widget *btMenu; InitYtStuff(); @@ -349,14 +350,21 @@ SceVoid menu::youtube::Base::FirstTimeInit() g_empvaPlugin->TemplateOpen(g_rootPage, &searchParam, &tmpParam); searchParam.hash = EMPVAUtils::GetHash("yt_plane_top_search"); - commonWidget = g_rootPage->GetChildByHash(&searchParam, 0); - commonWidget->PlayAnimationReverse(0.0f, ui::Widget::Animation_Reset); + ytTopPlane = g_rootPage->GetChildByHash(&searchParam, 0); + ytTopPlane->PlayAnimationReverse(0.0f, ui::Widget::Animation_Reset); searchParam.hash = EMPVAUtils::GetHash("yt_image_button_top_search"); - commonWidget = commonWidget->GetChildByHash(&searchParam, 0); + commonWidget = ytTopPlane->GetChildByHash(&searchParam, 0); auto searchActionButtonCB = new menu::youtube::SearchActionButtonCB(); commonWidget->RegisterEventCallback(0x10000008, searchActionButtonCB, 0); + /* + searchParam.hash = EMPVAUtils::GetHash("yt_text_box_top_search"); + commonWidget = ytTopPlane->GetChildByHash(&searchParam, 0); + searchActionButtonCB = new menu::youtube::SearchActionButtonCB(); + commonWidget->RegisterEventCallback(0x10000008, searchActionButtonCB, 0); + */ + searchParam.hash = EMPVAUtils::GetHash("yt_plane_bottommenu"); btMenu = g_rootPage->GetChildByHash(&searchParam, 0); diff --git a/ElevenMPV-A/source/menus/youtube/menu_youtube_fav.cpp b/ElevenMPV-A/source/menus/youtube/menu_youtube_fav.cpp index 953faab..9376535 100644 --- a/ElevenMPV-A/source/menus/youtube/menu_youtube_fav.cpp +++ b/ElevenMPV-A/source/menus/youtube/menu_youtube_fav.cpp @@ -72,7 +72,7 @@ SceVoid menu::youtube::FavParserThread::CreateVideoButton(FavPage *page, const c buttonCB->pUserData = buttonCB; buttonCB->mode = menu::youtube::Base::Mode_Fav; buttonCB->url = url; - button->RegisterEventCallback(ui::Widget::EventMain_Pressed, buttonCB, 0); + button->RegisterEventCallback(ui::Widget::EventMain_Decide, buttonCB, 0); youtube_get_video_thumbnail_url_by_id(data, tmb, sizeof(tmb)); diff --git a/ElevenMPV-A/source/menus/youtube/menu_youtube_history.cpp b/ElevenMPV-A/source/menus/youtube/menu_youtube_history.cpp index 653ebff..7d95767 100644 --- a/ElevenMPV-A/source/menus/youtube/menu_youtube_history.cpp +++ b/ElevenMPV-A/source/menus/youtube/menu_youtube_history.cpp @@ -85,7 +85,7 @@ SceVoid menu::youtube::HistoryParserThread::CreateVideoButton(HistoryPage *page, buttonCB->pUserData = buttonCB; buttonCB->mode = menu::youtube::Base::Mode_History; buttonCB->url = url; - button->RegisterEventCallback(ui::Widget::EventMain_Pressed, buttonCB, 0); + button->RegisterEventCallback(ui::Widget::EventMain_Decide, buttonCB, 0); HttpFile::Open(&fres, tmb, &res, 0); if (res < 0) { diff --git a/ElevenMPV-A/source/menus/youtube/menu_youtube_search.cpp b/ElevenMPV-A/source/menus/youtube/menu_youtube_search.cpp index d6a8629..cbc10d5 100644 --- a/ElevenMPV-A/source/menus/youtube/menu_youtube_search.cpp +++ b/ElevenMPV-A/source/menus/youtube/menu_youtube_search.cpp @@ -62,7 +62,7 @@ SceVoid menu::youtube::SearchParserThread::CreateVideoButton(SearchPage *page, S buttonCB->pUserData = buttonCB; buttonCB->mode = menu::youtube::Base::Mode_Search; buttonCB->url = page->parseResult->results[index].video.url.c_str(); - button->RegisterEventCallback(ui::Widget::EventMain_Pressed, buttonCB, 0); + button->RegisterEventCallback(ui::Widget::EventMain_Decide, buttonCB, 0); } else if (page->parseResult->results[index].type == YouTubeSuccinctItem::PLAYLIST) { @@ -81,7 +81,7 @@ SceVoid menu::youtube::SearchParserThread::CreateVideoButton(SearchPage *page, S buttonCB->pUserData = buttonCB; buttonCB->mode = menu::youtube::Base::Mode_Search; buttonCB->url = page->parseResult->results[index].playlist.url.c_str(); - button->RegisterEventCallback(ui::Widget::EventMain_Pressed, buttonCB, 0); + button->RegisterEventCallback(ui::Widget::EventMain_Decide, buttonCB, 0); } if (res < 0) { diff --git a/ElevenMPV-A/source/utils.cpp b/ElevenMPV-A/source/utils.cpp index 6294607..ff93c2d 100644 --- a/ElevenMPV-A/source/utils.cpp +++ b/ElevenMPV-A/source/utils.cpp @@ -16,6 +16,7 @@ #include "common.h" #include "ipc.h" #include "yt_utils.h" +#include "menu_settings.h" #include "vitaaudiolib.h" static SceBool s_isDeactivated = SCE_FALSE; diff --git a/Resource/empva_plugin.xml b/Resource/empva_plugin.xml index 34c2964..43f7513 100644 --- a/Resource/empva_plugin.xml +++ b/Resource/empva_plugin.xml @@ -341,7 +341,7 @@ - +