• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

otcv8 json error 1fc0

Joriku

Working in the mines, need something?
Premium User
Joined
Jul 16, 2016
Messages
1,140
Solutions
15
Reaction score
431
Location
Sweden
So, I'm lost and can't find anything anywhere related to this issue.
So I am getting this once I set things up.
1736337582704.webp

I am running a Virtual Box,
192.168.10.213


1736337632892.webp
updater.php
LUA:
<?php
// CONFIG
$files_dir = "/var/www/html/otcv8/files";
$files_url = "http://192.168.10.213/otcv8/files";
$files_and_dirs = array("init.lua", "data", "modules", "layouts");
$checksum_file = "checksums.txt";
$checksum_update_interval = 60; // seconds
$binaries = array(
    "WIN32-WGL" => "otclient_gl.exe",
    "WIN32-EGL" => "otclient_dx.exe",
    "WIN32-WGL-GCC" => "otclient_gcc_gl.exe",
    "WIN32-EGL-GCC" => "otclient_gcc_dx.exe",
    "X11-GLX" => "otclient_linux",
    "X11-EGL" => "otclient_linux",
    "ANDROID-EGL" => "", // we can't update android binary
    "ANDROID64-EGL" => "" // we can't update android binary
);
// CONFIG END

function sendError($error) {
    echo(json_encode(array("error" => $error)));
    die();   
}

$raw_input = file_get_contents("php://input");
$data = json_decode($raw_input);

if (!$data || !is_object($data)) {
    sendError("Invalid input data. Ensure the request payload is valid JSON.");
}

$version = isset($data->version) ? $data->version : 0; // Default to 0 if not set
$build = isset($data->build) ? $data->build : "";     // Default to empty string if not set
$os = isset($data->os) ? $data->os : "unknown";       // Default to "unknown" if not set
$platform = isset($data->platform) ? $data->platform : ""; // Default to empty string if not set
$args = isset($data->args) ? $data->args : null;      // Default to null if not set
$binary = $binaries[$platform] ?: "";

$cache = null;
$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $checksum_file;
if (file_exists($cache_file) && (filemtime($cache_file) + $checksum_update_interval > time())) {
    $cache = json_decode(file_get_contents($cache_file), true);
}
if(!$cache) { // update cache
    $dir = realpath($files_dir);
    $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
    $cache = array();
    foreach ($rii as $file) {
        if (!$file->isFile())
            continue;
        $path = str_replace($dir, '', $file->getPathname());
        $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
        $cache[$path] = hash_file("crc32b", $file->getPathname());
    }
    file_put_contents($cache_file . ".tmp", json_encode($cache));
    rename($cache_file . ".tmp", $cache_file);
}
$ret = array("url" => $files_url, "files" => array(), "keepFiles" => false);
foreach($cache as $file => $checksum) {
    $base = trim(explode("/", ltrim($file, "/"))[0]);
    if(in_array($base, $files_and_dirs)) {
        $ret["files"][$file] = $checksum;
    }
    if($base == $binary && !empty($binary)) {
        $ret["binary"] = array("file" => $file, "checksum" => $checksum);
    }
}

echo(json_encode($ret, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

?>

1736337704907.webp

init.lua (before encryption)
LUA:
Services = {
  website = "http://192.168.10.213",
  updater = "http://192.168.10.213/otcv8/updater.php",--"http://yourwebsite/api/updater.php"
  stats = "", -- --"http://yourwebsite/api/stats.php"
  crash = "", --"http://yourwebsite/api/crash.php",
  feedback = "",--"http://yourwebsite/api/feedback.php",
  status = "" --http://yourwebsite/api/status.php"
}

Virtual box information
LUA:
a@a:/var/www/html/otcv8/files$ curl -X POST -H "Content-Type: application/json" -d '{}' http://192.168.10.213/otcv8/updater.php
{
    "url": "http://192.168.10.213/otcv8/files",
    "files": {
        "/data/shaders/outfit_rainbow_vertex.frag": "cfe6e637",
        "/data/shaders/outfit_rainbow_fragment.frag": "6932dffb",
        "/data/shaders/map_rainbow_fragment.frag": "f68e6fff",
// Lot more info, removed due to limitations of otland characters
    },
    "keepFiles": false
}a@a:/var/www/html/otcv8/files$

1736337780272.webp
1736337807496.webp
 
So, I'm lost and can't find anything anywhere related to this issue.
I got 2 ideas:
1. remove ?> at end of PHP files
2. make sure that all PHP files are encoded with Unix/Linux line endings (LF character), not Windows line endings (CRLF - 2 characters)

If they do not help, then we got to get result of Virtual box information.
Execute:
Code:
curl -X POST -H "Content-Type: application/json" -o output.txt -d '{}' http://192.168.10.213/otcv8/updater.php
and post output.txt as file attachment on OTLand.
Error says something about 1fc0, so maybe there is this value somewhere in PHP response and we can find out why it's formatted wrong in JSON.
 
I got 2 ideas:
1. remove ?> at end of PHP files
2. make sure that all PHP files are encoded with Unix/Linux line endings (LF character), not Windows line endings (CRLF - 2 characters)

If they do not help, then we got to get result of Virtual box information.
Execute:
Code:
curl -X POST -H "Content-Type: application/json" -o output.txt -d '{}' http://192.168.10.213/otcv8/updater.php
and post output.txt as file attachment on OTLand.
Error says something about 1fc0, so maybe there is this value somewhere in PHP response and we can find out why it's formatted wrong in JSON.
1) Removed ?> from updater.php, results in the same.

2)
1736679715143.webp
 

Attachments

IDK why OTC gets this 1fc0, but it looks like it's added at start of JSON. output.txt does not contain it, so it must be something with updater code in OTC or JSON library in OTC.
You will have to add some code in updater module/JSON library to print received JSON and detect where it adds 1fc0.
 
So I did this instead after a friends tips.

Using this, made an update possible with the same steps as the tutorial explained it.
I have not tried out using the dev packages to compile it, in case of source edits. But this works for now.

Then, the desp says (by image):
1736763217595.webp

Thank you Gesior for responding to the thread, really appreciated.

And to note for others:
No, I did not have to change anything extra for this step to work, and the updater works locally and through an host machine (live).
I've updated the client a few times, and it works.

GL and DX seems to respond fine.
 

Similar threads

Back
Top