Skip to content

Commit

Permalink
Merge pull request xbmc#13036 from garbear/retroplayer-android
Browse files Browse the repository at this point in the history
RetroPlayer: Android support
  • Loading branch information
garbear committed Nov 19, 2017
2 parents ab0ddd7 + 6107728 commit 43edb81
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 14 deletions.
1 change: 1 addition & 0 deletions cmake/treedata/android/subdirs.txt
@@ -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
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
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
@@ -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
@@ -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
@@ -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
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
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
Expand Up @@ -34,7 +34,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 @@ -82,7 +82,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

0 comments on commit 43edb81

Please sign in to comment.