Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetroPlayer: Android support #13036

Merged
merged 3 commits into from
Nov 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/treedata/android/subdirs.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
xbmc/cores/RetroPlayer/process/android cores/RetroPlayer/process/android
xbmc/linux linuxsupport
xbmc/input/touch input/touch
xbmc/input/touch/generic input/touch/generic
Expand Down
38 changes: 29 additions & 9 deletions xbmc/addons/binary-addons/AddonDll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ CAddonDll::~CAddonDll()
Destroy();
}

bool CAddonDll::LoadDll()
std::string CAddonDll::GetDllPath(const std::string &libPath)
{
if (m_pDll)
return true;
std::string strFileName = libPath;
std::string strLibName = URIUtils::GetFileName(strFileName);

std::string strFileName = LibPath();
std::string strAltFileName;
if (strLibName.empty())
return "";

/* Check if lib being loaded exists, else check in XBMC binary location */
#if defined(TARGET_ANDROID)
Expand All @@ -92,15 +92,18 @@ bool CAddonDll::LoadDll()
if (!XFILE::CFile::Exists(strFileName))
{
std::string tempbin = getenv("XBMC_ANDROID_LIBS");
strFileName = tempbin + "/" + m_addonInfo.LibName();
strFileName = tempbin + "/" + strLibName;
}
#endif

if (!XFILE::CFile::Exists(strFileName))
{
std::string strAltFileName;

std::string altbin = CSpecialProtocol::TranslatePath("special://xbmcaltbinaddons/");
if (!altbin.empty())
{
strAltFileName = altbin + m_addonInfo.LibName();
strAltFileName = altbin + strLibName;
if (!XFILE::CFile::Exists(strAltFileName))
{
std::string temp = CSpecialProtocol::TranslatePath("special://xbmc/addons/");
Expand All @@ -121,12 +124,29 @@ bool CAddonDll::LoadDll()
strFileName = tempbin + strFileName;
if (!XFILE::CFile::Exists(strFileName))
{
CLog::Log(LOGERROR, "ADDON: Could not locate %s", m_addonInfo.LibName().c_str());
return false;
CLog::Log(LOGERROR, "ADDON: Could not locate %s", strLibName.c_str());
strFileName.clear();
}
}
}

return strFileName;
}

std::string CAddonDll::LibPath() const
{
return GetDllPath(CAddon::LibPath());
}

bool CAddonDll::LoadDll()
{
if (m_pDll)
return true;

std::string strFileName = LibPath();
if (strFileName.empty())
return false;

/* Load the Dll */
m_pDll = new DllAddon;
m_pDll->SetFile(strFileName);
Expand Down
5 changes: 5 additions & 0 deletions xbmc/addons/binary-addons/AddonDll.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ namespace ADDON

virtual ADDON_STATUS GetStatus();

// Implementation of IAddon via CAddon
std::string LibPath() const override;

// addon settings
void SaveSettings() override;
std::string GetSetting(const std::string& key) override;
Expand Down Expand Up @@ -73,6 +76,8 @@ namespace ADDON
protected:
bool Initialized() { return m_initialized; }

static std::string GetDllPath(const std::string &strFileName);

CAddonInterfaces* m_pHelpers;
std::string m_parentLib;

Expand Down
4 changes: 4 additions & 0 deletions xbmc/cores/RetroPlayer/process/android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(SOURCES RPProcessInfoAndroid.cpp)
set(HEADERS RPProcessInfoAndroid.h)

core_add_library(rp-process-android)
34 changes: 34 additions & 0 deletions xbmc/cores/RetroPlayer/process/android/RPProcessInfoAndroid.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2017 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this Program; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/

#include "RPProcessInfoAndroid.h"

using namespace KODI;
using namespace RETRO;

CRPProcessInfo* CRPProcessInfoAndroid::Create()
{
return new CRPProcessInfoAndroid();
}

void CRPProcessInfoAndroid::Register()
{
CRPProcessInfo::RegisterProcessControl(CRPProcessInfoAndroid::Create);
}
35 changes: 35 additions & 0 deletions xbmc/cores/RetroPlayer/process/android/RPProcessInfoAndroid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2017 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this Program; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once

#include "cores/RetroPlayer/process/RPProcessInfo.h"

namespace KODI
{
namespace RETRO
{
class CRPProcessInfoAndroid : public CRPProcessInfo
{
public:
static CRPProcessInfo* Create();
static void Register();
};
}
}
4 changes: 2 additions & 2 deletions xbmc/games/addons/GameClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ std::string CGameClient::LibPath() const
{
// If the game client requires a proxy, load its DLL instead
if (m_struct.props.proxy_dll_count > 0)
return m_struct.props.proxy_dll_paths[0];
return GetDllPath(m_struct.props.proxy_dll_paths[0]);

return CAddon::LibPath();
return CAddonDll::LibPath();
}

ADDON::AddonPtr CGameClient::GetRunningInstance() const
Expand Down
2 changes: 1 addition & 1 deletion xbmc/games/addons/GameClientProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const char* CGameClientProperties::GetLibraryPath(void)
if (m_strLibraryPath.empty())
{
// Get the parent add-on's real path
std::string strLibPath = m_parent->CAddon::LibPath();
std::string strLibPath = m_parent->CAddonDll::LibPath();
m_strLibraryPath = CSpecialProtocol::TranslatePath(strLibPath);
}
return m_strLibraryPath.c_str();
Expand Down
5 changes: 3 additions & 2 deletions xbmc/windowing/android/WinSystemAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "threads/SingleLock.h"
#include "platform/android/activity/XBMCApp.h"

#include "cores/RetroPlayer/process/RPProcessInfo.h"
#include "cores/RetroPlayer/process/android/RPProcessInfoAndroid.h"
#include "cores/RetroPlayer/rendering/VideoRenderers/RPRendererGuiTexture.h"
#include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h"
#include "cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecAndroidMediaCodec.h"
Expand Down Expand Up @@ -79,7 +79,8 @@ bool CWinSystemAndroid::InitWindowSystem()
CDVDAudioCodecAndroidMediaCodec::Register();

CLinuxRendererGLES::Register();
RETRO::CRPProcessInfo::RegisterRendererFactory(new RETRO::CRendererFactoryGuiTexture);
RETRO::CRPProcessInfoAndroid::Register();
RETRO::CRPProcessInfoAndroid::RegisterRendererFactory(new RETRO::CRendererFactoryGuiTexture);
CRendererMediaCodec::Register();
CRendererMediaCodecSurface::Register();

Expand Down