Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapheneCt committed Dec 22, 2021
1 parent 66e1820 commit 5472e70
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 30 deletions.
4 changes: 2 additions & 2 deletions ElevenMPV-A-libScePafPreload/prx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Binary file modified ElevenMPV-A/CONTENTS/empva_plugin.rco
Binary file not shown.
Binary file modified ElevenMPV-A/CONTENTS/module/libScePafPreload.suprx
Binary file not shown.
2 changes: 2 additions & 0 deletions ElevenMPV-A/include/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ namespace audio {
SceNmHandle nmHandle;
SceUInt64 totalTime;
SceUInt64 samplesRead;
SceUInt64 seekTargetSamples;
SceUInt32 sampleRate;
SceInt32 maxSamples;
SceUInt8 channelNum;
Expand Down Expand Up @@ -438,6 +439,7 @@ namespace audio {
SceNmHandle nmHandle;
SceUInt64 totalTime;
SceUInt64 samplesRead;
SceUInt64 seekTargetSamples;
SceUInt32 sampleRate;
SceInt32 maxSamples;
SceUInt8 channelNum;
Expand Down
2 changes: 1 addition & 1 deletion ElevenMPV-A/param.sfx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<paramsfo>
<param key="APP_VER">06.01</param>
<param key="APP_VER">06.02</param>
<param key="ATTRIBUTE">17338504</param>
<param key="ATTRIBUTE_MINOR">16</param>
<param key="ATTRIBUTE2">0</param>
Expand Down
2 changes: 1 addition & 1 deletion ElevenMPV-A/param_for_debug.sfx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<paramsfo>
<param key="APP_VER">06.01</param>
<param key="APP_VER">06.02</param>
<param key="ATTRIBUTE">17338504</param>
<param key="ATTRIBUTE_MINOR">16</param>
<param key="ATTRIBUTE2">0</param>
Expand Down
10 changes: 6 additions & 4 deletions ElevenMPV-A/source/audio/webm_opus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -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);

Expand Down
10 changes: 6 additions & 4 deletions ElevenMPV-A/source/audio/youtube_opus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -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);

Expand Down
18 changes: 16 additions & 2 deletions ElevenMPV-A/source/downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
Expand Down
20 changes: 13 additions & 7 deletions ElevenMPV-A/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <libnetctl.h>
#include <libhttp.h>
#include <paf.h>
#include <stdlib.h>

#include "common.h"
#include "main.h"
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -178,15 +183,15 @@ 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;
}
}

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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ElevenMPV-A/source/menus/menu_displayfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 11 additions & 3 deletions ElevenMPV-A/source/menus/youtube/menu_youtube_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ElevenMPV-A/source/menus/youtube/menu_youtube_fav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion ElevenMPV-A/source/menus/youtube/menu_youtube_history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions ElevenMPV-A/source/menus/youtube/menu_youtube_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions ElevenMPV-A/source/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Resource/empva_plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@

<plane style="_common_style_plane_transparent" id="yt_plane_top_search">
<layout_hint align="0, 2" anchor="0, 2" size="700, 96" pos="-130, 0" />
<text_box auto_scroll="1" ime_type="1" edit_mode="1" paste_mode="1" edit_auto_transition_mode="0" style="yt_style_text_box_top_search" id="yt_text_box_top_search" >
<text_box auto_scroll="1" ime_type="0" edit_mode="1" paste_mode="1" edit_auto_transition_mode="0" style="yt_style_text_box_top_search" id="yt_text_box_top_search" >
<layout_hint pos="122, 8" adjust="0, 0" anchor="1, 1" align="1, 1" size="740, 50" />
<focus_hint focus_shape="0" />
</text_box>
Expand Down

0 comments on commit 5472e70

Please sign in to comment.