[Feat] (getter.*|version.h): Add version controller. Add alpha version protection.

Signed-off-by: BZLZHH <admin@bzlzhh.top>
This commit is contained in:
BZLZHH 2025-02-08 01:59:44 +08:00
parent 3910fb0ca4
commit 043986a081
3 changed files with 33 additions and 2 deletions

View File

@ -136,6 +136,7 @@ const char* getGLESName() {
}
static std::string rendererString;
static std::string versionString;
const GLubyte * glGetString( GLenum name ) {
LOG();
LOAD_GLES_FUNC(glGetString);
@ -156,9 +157,19 @@ const GLubyte * glGetString( GLenum name ) {
*/
switch (name) {
case GL_VENDOR:
return (const GLubyte *) "Swung0x48, BZLZHH, Tungsten";
return (const GLubyte *)(std::string("Swung0x48, BZLZHH, Tungsten") +
std::string(version_type == VERSION_ALPHA ? " | §c§l内测版本, 严禁任何外传!§r" : "")).c_str();
case GL_VERSION:
return (const GLubyte *) "4.0.0 MobileGlues";
if (versionString == std::string("")) {
versionString = "4.0.0 MobileGlues";
std::string realVersion = " " + std::to_string(MAJOR) + "." +
std::to_string(MINOR) + "." +
std::to_string(REVISION);
std::string suffix = version_type == VERSION_ALPHA ? " | §4§l您如果在公开平台看到这一提示, 则发布者已违规!§r" :
realVersion + std::string(version_type == VERSION_DEVELOPMENT?".Dev":"");
versionString += suffix;
}
return (const GLubyte *)versionString.c_str();
case GL_RENDERER:
{
if (rendererString == std::string("")) {

View File

@ -9,6 +9,7 @@
#include "loader.h"
#include "../gles/loader.h"
#include "mg.h"
#include "../version.h"
#ifndef MOBILEGLUES_GETTER_H
#define MOBILEGLUES_GETTER_H

19
src/main/cpp/version.h Normal file
View File

@ -0,0 +1,19 @@
//
// Created by BZLZHH on 2025/2/8.
//
#ifndef MOBILEGLUES_VERSION_H
#define VERSION_DEVELOPMENT 0
#define VERSION_ALPHA 1
#define VERSION_RELEASE 2
#define MAJOR 0
#define MINOR 0
#define REVISION 1
const int version_type = VERSION_ALPHA;
#define MOBILEGLUES_VERSION_H
#endif //MOBILEGLUES_VERSION_H