From 79c3a7d5e2d3ae0274a7122246a6922b74e8cdaf Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Sat, 4 Jul 2015 21:54:09 +0300
Subject: [PATCH] Revert "changed: get rid of DATAPATH definition"

This reverts commit 60467a6492adb32b7487274ceaec4f76c13eec1a.
---
 CMakeLists.txt |  2 ++
 src/Main.cpp   | 28 +++-------------------------
 2 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77bcb6e..d73d069 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,6 +13,8 @@ find_package(GLEW REQUIRED)
 find_package(ProjectM REQUIRED)
 
 add_definitions(-DHAS_SDL_OPENGL)
+set(DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/xbmc/addons/visualization.projectm/resources")
+add_definitions(-DDATAPATH="${DATA_PATH}")
 
 set(INCLUDES ${OpenGL_INCLUDE_DIR}
              ${GLEW_INCLUDE_DIR}
diff --git a/src/Main.cpp b/src/Main.cpp
index 449cb85..81205dc 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -55,7 +55,6 @@
 
 #include <xbmc_vis_dll.h>
 #include <xbmc_addon_cpp_dll.h>
-#include <libXBMC_addon.h>
 
 #if !defined(__APPLE__)
 #include <GL/glew.h>
@@ -79,8 +78,6 @@ bool lastLockStatus;
 int lastPresetIdx;
 unsigned int lastLoggedPresetIdx;
 
-ADDON::CHelper_libXBMC_addon *XBMC           = NULL;
-
 //-- Create -------------------------------------------------------------------
 // Called once when the visualisation is created by XBMC. Do any setup here.
 //-----------------------------------------------------------------------------
@@ -89,15 +86,6 @@ extern "C" ADDON_STATUS ADDON_Create(void* hdl, void* props)
   if (!props)
     return ADDON_STATUS_UNKNOWN;
 
-  if (!XBMC)
-    XBMC = new ADDON::CHelper_libXBMC_addon;
-
-  if (!XBMC->RegisterMe(hdl))
-  {
-    delete XBMC, XBMC=NULL;
-    return ADDON_STATUS_PERMANENT_FAILURE;
-  }
-
   VIS_PROPS* visprops = (VIS_PROPS*)props;
 
   strcpy(g_visName, visprops->name);
@@ -109,13 +97,8 @@ extern "C" ADDON_STATUS ADDON_Create(void* hdl, void* props)
   g_configPM.windowHeight = visprops->height;
   g_configPM.aspectCorrection = true;
   g_configPM.easterEgg = 0.0;
-  char path[1024];
-  XBMC->GetSetting("__addonpath__", path);
-  strcat(path,"/resources");
-  g_configPM.titleFontURL = path;
-  g_configPM.titleFontURL += "/Vera.ttf";
-  g_configPM.menuFontURL = path;
-  g_configPM.menuFontURL += "/VeraMono.ttf";
+  g_configPM.titleFontURL = DATAPATH"/Vera.ttf";
+  g_configPM.menuFontURL = DATAPATH"/VeraMono.ttf";
   lastLoggedPresetIdx = lastPresetIdx;
 
   return ADDON_STATUS_NEED_SAVEDSETTINGS;
@@ -351,12 +334,7 @@ void ChoosePresetPack(int pvalue)
 {
   g_UserPackFolder = false;
   if (pvalue == 0)
-  {
-    char path[1024];
-    XBMC->GetSetting("__addonpath__", path);
-    g_configPM.presetURL = path;
-    g_configPM.presetURL += "/resources/presets";
-  }
+    g_configPM.presetURL = DATAPATH"/presets";
   else if (pvalue == 1) //User preset folder has been chosen
     g_UserPackFolder = true;
 }
-- 
2.1.4

