mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-01-04 00:23:25 +08:00
c5d57c03ee
* Replace protobuf 2.6.1 with 3.21.8 * Update/add protobuf libs * Add CS2 protos * Remove old csgo/dota protos * Add versioned protoc bin * Comment out Valve's `schema` define for now * Use ENetworkDisconnectionReason * Fix-up `offsetof` to avoid errors on some Clang versions
22 lines
752 B
PHP
22 lines
752 B
PHP
<?php
|
|
|
|
define("GOOGLE_INTERNAL_NAMESPACE", "Google\\Protobuf\\Internal\\");
|
|
define("GOOGLE_NAMESPACE", "Google\\Protobuf\\");
|
|
define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\");
|
|
|
|
function protobuf_autoloader_impl($class, $prefix) {
|
|
$length = strlen($prefix);
|
|
if ((substr($class, 0, $length) === $prefix)) {
|
|
$path = '../php/src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php';
|
|
include_once $path;
|
|
}
|
|
}
|
|
|
|
function protobuf_autoloader($class) {
|
|
protobuf_autoloader_impl($class, GOOGLE_INTERNAL_NAMESPACE);
|
|
protobuf_autoloader_impl($class, GOOGLE_NAMESPACE);
|
|
protobuf_autoloader_impl($class, GOOGLE_GPBMETADATA_NAMESPACE);
|
|
}
|
|
|
|
spl_autoload_register('protobuf_autoloader');
|