+
+function renderGameFile($gameDataFile)
+{
+ $json = json_decode(file_get_contents($gameDataFile));
+ $appsDir = dirname($gameDataFile, 2) . '/apps/';
+ $downloadJson = json_decode(
+ file_get_contents(
+ $appsDir . $json->version->uuid . '-download.json'
+ )
+ );
+ $apkDownloadUrl = $downloadJson->app->downloadLink;
+
+ $navLinks = [];
+ foreach ($json->genres as $genreTitle) {
+ $url = '../discover/' . categoryPath($genreTitle) . '.htm';
+ $navLinks[$url] = $genreTitle;
+ }
+
+ $gameTemplate = __DIR__ . '/../data/templates/game.tpl.php';
+ ob_start();
+ include $gameTemplate;
+ $html = ob_get_contents();
+ ob_end_clean();
+
+ return $html;
+}