Skip to content

Commit

Permalink
Fixed YouTube page navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapheneCt committed Dec 27, 2022
1 parent 5df5edf commit 8c015d7
Show file tree
Hide file tree
Showing 21 changed files with 692 additions and 926 deletions.
Binary file modified NetStream/CONTENTS/module/download_enabler_netstream.suprx
Binary file not shown.
7 changes: 7 additions & 0 deletions NetStream/CONTENTS/netstream_plugin.rcd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ key:e950a63a(0) id:plane_browser_root_page_http
key:0225f81e(0) id:busyindicator_loader_page_http
key:3d5b0c73(0) id:button_back_page_http
key:82e2e83c(0) id:button_settings_page_http
key:1332c3df(0) id:page_local
key:a7a58bf5(0) id:plane_base_bg_page_local
key:de4604fd(0) id:template_ref_top_title_bar_page_local
key:137b43f7(0) id:plane_browser_root_page_local
key:262eecf2(0) id:busyindicator_loader_page_local
key:e24ed91b(0) id:button_back_page_local
key:6ce20cb2(0) id:button_settings_page_local
key:d9d437d7(0) id:page_youtube
key:86efefd3(0) id:plane_base_bg_page_youtube
key:a1049fc2(0) id:template_ref_top_title_bar_page_youtube
Expand Down
Binary file modified NetStream/CONTENTS/netstream_plugin.rco
Binary file not shown.
6 changes: 5 additions & 1 deletion NetStream/NetStream.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
<ClCompile Include="source\dialog.cpp" />
<ClCompile Include="source\downloader.cpp" />
<ClCompile Include="source\http_server_browser.cpp" />
<ClCompile Include="source\local_server_browser.cpp" />
<ClCompile Include="source\main.cpp" />
<ClCompile Include="source\menus\menu_first.cpp" />
<ClCompile Include="source\menus\menu_generic.cpp" />
<ClCompile Include="source\menus\menu_http.cpp" />
<ClCompile Include="source\menus\menu_local.cpp" />
<ClCompile Include="source\menus\menu_player_simple.cpp" />
<ClCompile Include="source\menus\menu_settings.cpp" />
<ClCompile Include="source\menus\menu_youtube.cpp" />
Expand All @@ -35,10 +37,12 @@
<ClInclude Include="include\dialog.h" />
<ClInclude Include="include\downloader.h" />
<ClInclude Include="include\http_server_browser.h" />
<ClInclude Include="include\local_server_browser.h" />
<ClInclude Include="include\main.h" />
<ClInclude Include="include\menus\menu_first.h" />
<ClInclude Include="include\menus\menu_generic.h" />
<ClInclude Include="include\menus\menu_http.h" />
<ClInclude Include="include\menus\menu_local.h" />
<ClInclude Include="include\menus\menu_player_simple.h" />
<ClInclude Include="include\menus\menu_settings.h" />
<ClInclude Include="include\menus\menu_youtube.h" />
Expand Down Expand Up @@ -93,7 +97,7 @@
<AdditionalOptions>--no-standard-libraries </AdditionalOptions>
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;$(ProjectDir)libs\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateSnMapFile>FullMapFile</GenerateSnMapFile>
<AdditionalDependencies>-lSceSysmem_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceModuleMgr_stub;-lSceProcessMgr_stub;-lSceTouch_stub;-lSceAppMgr_stub;-lSceAppMgrUser_stub;-lSceAppUtil_stub;-lSceAudio_stub;-lSceCtrl_stub;-lSceDisplay_stub;-lScePower_stub;-lSceSysmodule_stub;-lSceGxm_stub;-lSceDbg_stub;-lScePafThread_stub;-lScePafStdc_stub;-lScePafToplevel_stub;-lScePafResource_stub;-lScePafWidget_stub;-lScePafMisc_stub;-lScePafCommon_stub;-lScePafGraphics_stub;-lSceLibKernel_stub;-lSceNet_stub;-lSceNetCtl_stub;-lSceHttp_stub;-lSceSsl_stub;-lSceAppSettings_stub;-lSceCommonGuiDialog_stub;-lSceIniFileProcessor_stub;-lSceBEAVCorePlayer_stub;-lSceDmacmgr_stub;-lSceFiber_stub;-lSceVshBridge_stub;-ltaihenUnsafe_stub;-lInvidious_stub;-lcurl_stub;-lsnc;-lCurlFile;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>-lSceIpmi_stub;-lSceSysmem_stub;-lSceThreadMgr_stub;-lSceThreadmgrCoredumpTime_stub;-lSceModuleMgr_stub;-lSceProcessMgr_stub;-lSceTouch_stub;-lSceAppMgr_stub;-lSceAppMgrUser_stub;-lSceAppUtil_stub;-lSceAudio_stub;-lSceCtrl_stub;-lSceDisplay_stub;-lScePower_stub;-lSceSysmodule_stub;-lSceGxm_stub;-lSceDbg_stub;-lScePafThread_stub;-lScePafStdc_stub;-lScePafToplevel_stub;-lScePafResource_stub;-lScePafWidget_stub;-lScePafMisc_stub;-lScePafCommon_stub;-lScePafGraphics_stub;-lSceLibKernel_stub;-lSceNet_stub;-lSceNetCtl_stub;-lSceHttp_stub;-lSceSsl_stub;-lSceAppSettings_stub;-lSceCommonGuiDialog_stub;-lSceIniFileProcessor_stub;-lSceBEAVCorePlayer_stub;-lSceDmacmgr_stub;-lSceFiber_stub;-lSceVshBridge_stub;-ltaihenUnsafe_stub;-lInvidious_stub;-lcurl_stub;-lsnc;-lCurlFile;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>"$(SCE_PSP2_SDK_DIR)/host_tools/build/bin/vdsuite-pubprx.exe" --boot-param "$(ProjectDir)ebootparam.bin" "$(LocalDebuggerCommand)" "$(OutDir)eboot.bin"</Command>
Expand Down
12 changes: 12 additions & 0 deletions NetStream/NetStream.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
<ClCompile Include="source\downloader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\local_server_browser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\menus\menu_local.cpp">
<Filter>Source Files\menus</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\common.h">
Expand Down Expand Up @@ -118,6 +124,12 @@
<ClInclude Include="include\downloader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\local_server_browser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\menus\menu_local.h">
<Filter>Header Files\menus</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Xml Include="RES_RCO\netstream_plugin.xml">
Expand Down
16 changes: 16 additions & 0 deletions NetStream/RES_RCO/netstream_plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@
<corner_button style="_common_style_corner_bottom_right" id="button_settings_page_http" />
</page>

<!-- local server page -->
<page id="page_local">
<plane texture="tex_common_bg" id="plane_base_bg_page_local">
<layout_hint size="960, 544" />
</plane>
<template_ref id="template_ref_top_title_bar_page_local" template="template_top_title_bar" />
<plane style="_common_style_plane_transparent" id="plane_browser_root_page_local">
<layout_hint size="960, 544" />
</plane>
<busyindicator style="style_busyindicator_big" texture="_common_texture_busy" id="busyindicator_loader_page_local" >
<layout_hint size="75, 75" />
</busyindicator>
<corner_button style="_common_style_corner_bottom_left" id="button_back_page_local" />
<corner_button style="_common_style_corner_bottom_right" id="button_settings_page_local" />
</page>

<!-- youtube browser page -->
<page id="page_youtube">
<plane texture="tex_common_bg" id="plane_base_bg_page_youtube">
Expand Down
2 changes: 2 additions & 0 deletions NetStream/include/http_server_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <paf.h>
#include <psp2_compat/curl/curl.h>

using namespace paf;

class HttpServerBrowser
{
public:
Expand Down
52 changes: 52 additions & 0 deletions NetStream/include/local_server_browser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef _LOCAL_SERVER_BROWSER_H_
#define _LOCAL_SERVER_BROWSER_H_

#include <kernel.h>
#include <paf.h>
#include <psp2_compat/curl/curl.h>

using namespace paf;

class LocalServerBrowser
{
public:

class Entry
{
public:

enum Type
{
Type_UnsupportedFile,
Type_SupportedFile,
Type_Folder
};

string ref;
Type type;
};

LocalServerBrowser();

~LocalServerBrowser();

SceBool Probe();

SceBool IsAtRoot(string *current);

SceBool IsAtRoot();

SceVoid SetPath(const char *ref);

string GetPath();

string GetBEAVUrl(string *in);

vector<LocalServerBrowser::Entry *> *GoTo(const char *ref, SceInt32 *result);

private:

string path;
};

#endif
114 changes: 114 additions & 0 deletions NetStream/include/menus/menu_local.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#ifndef _MENU_LOCAL_H_
#define _MENU_LOCAL_H_

#include <kernel.h>
#include <paf.h>

#include "dialog.h"
#include "menu_generic.h"
#include "local_server_browser.h"
#include "menus/menu_player_simple.h"

using namespace paf;

namespace menu {
class Local : public GenericMenu
{
public:

static SceVoid PlayerBackCb(PlayerSimple *player, ScePVoid pUserArg);
static SceVoid PlayerFailCb(PlayerSimple *player, ScePVoid pUserArg);
static SceVoid BackButtonCbFun(SceInt32 eventId, ui::Widget *self, SceInt32 a3, ScePVoid pUserData);
static SceVoid ListButtonCbFun(SceInt32 eventId, ui::Widget *self, SceInt32 a3, ScePVoid pUserData);

class ListViewCb : public ui::ListView::ItemCallback
{
public:

~ListViewCb()
{

}

ui::ListItem *Create(Param *info);

SceVoid Start(Param *info)
{
info->parent->PlayEffect(0.0f, effect::EffectType_Popup1);
}

Local *workObj;
};

class GoToJob : public job::JobItem
{
public:

using job::JobItem::JobItem;

~GoToJob() {}

SceVoid Run();

SceVoid Finish() {}

static SceVoid ConnectionFailedDialogHandler(dialog::ButtonCode buttonCode, ScePVoid pUserArg);

Local *workObj;
string targetRef;
};

class BrowserPage
{
public:

BrowserPage() : isLoaded(SCE_FALSE)
{

}

~BrowserPage()
{

}

vector<LocalServerBrowser::Entry *> *itemList;
ui::ListView *list;
SceBool isLoaded;
};

Local();

~Local();

MenuType GetMenuType()
{
return MenuType_Http;
}

const SceUInt32 *GetSupportedSettingsItems(SceInt32 *count)
{
*count = sizeof(k_settingsIdList) / sizeof(char*);
return k_settingsIdList;
}

SceBool PushBrowserPage(string *ref);

SceBool PopBrowserPage();

LocalServerBrowser *browser;
ui::Widget *browserRoot;
ui::BusyIndicator *loaderIndicator;
ui::Text *topText;
vector<BrowserPage *> pageList;
SceBool firstBoot;

private:

const SceUInt32 k_settingsIdList[1] = {
http_setting
};
};
}

#endif
7 changes: 7 additions & 0 deletions NetStream/include/netstream_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
#define busyindicator_loader_page_http (0x0225f81e)
#define button_back_page_http (0x3d5b0c73)
#define button_settings_page_http (0x82e2e83c)
#define page_local (0x1332c3df)
#define plane_base_bg_page_local (0xa7a58bf5)
#define template_ref_top_title_bar_page_local (0xde4604fd)
#define plane_browser_root_page_local (0x137b43f7)
#define busyindicator_loader_page_local (0x262eecf2)
#define button_back_page_local (0xe24ed91b)
#define button_settings_page_local (0x6ce20cb2)
#define page_youtube (0xd9d437d7)
#define plane_base_bg_page_youtube (0x86efefd3)
#define template_ref_top_title_bar_page_youtube (0xa1049fc2)
Expand Down
10 changes: 0 additions & 10 deletions NetStream/source/downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,12 @@ SceInt32 Downloader::Enqueue(const char *url, const char *name)
bfInfo.data1 = &minfo;
bfInfo.data1Size = sizeof(sce::Download::MetadataInfo);

sceClibPrintf("download url: %s\n", hparam.url);

ret = dw.client->invokeSyncMethod(0x1234000D, &dtInfo, 2, &ret2, &bfInfo, 1);
sceClibPrintf("invokeSyncMethod ret: 0x%08X\n", ret);
sceClibPrintf("invokeSyncMethod ret2: 0x%08X\n", ret2);
if (ret != SCE_OK)
return ret;
else if (ret2 != SCE_OK)
return ret2;

sceClibPrintf("meta info:\n");
sceClibPrintf("name: %s\n", minfo.name);
sceClibPrintf("size: %u\n", minfo.size);
sceClibPrintf("mimeType: %s\n", minfo.mimeType);
sceClibPrintf("creationDateString: %s\n", minfo.creationDateString);

sce_paf_memset(&minfo.name, 0, sizeof(minfo.name));
sce_paf_strcpy((char *)minfo.name, name);

Expand Down
14 changes: 7 additions & 7 deletions NetStream/source/http_server_browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,23 @@ vector<HttpServerBrowser::Entry *> *HttpServerBrowser::GoTo(const char *ref, Sce
{
buffer[posInBuf - 1] = 0;

char *ref = SCE_NULL;
char *href = SCE_NULL;
char *refEnd = buffer;
while (1)
{
ref = sce_paf_strstr(refEnd + 1, "<a href=\"");
if (!ref)
href = sce_paf_strstr(refEnd + 1, "<a href=\"");
if (!href)
break;
ref += 9;
href += 9;

refEnd = sce_paf_strstr(ref, "\">");
refEnd = sce_paf_strstr(href, "\">");
*refEnd = 0;

BEAVPlayer::SupportType beavType = BEAVPlayer::IsSupported(ref);
BEAVPlayer::SupportType beavType = BEAVPlayer::IsSupported(href);

if (beavType != BEAVPlayer::SupportType_NotSupported)
{
char *decoded = curl_easy_unescape(curl, ref, 0, SCE_NULL);
char *decoded = curl_easy_unescape(curl, href, 0, SCE_NULL);
HttpServerBrowser::Entry *entry = new HttpServerBrowser::Entry();
entry->ref = decoded;
entry->type = HttpServerBrowser::Entry::Type_UnsupportedFile;
Expand Down
Loading

0 comments on commit 8c015d7

Please sign in to comment.