mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 17:17:09 -04:00
Move stuff like SKIN_SERVER into Constants.h to make it easier to rebrand the game
This commit is contained in:
parent
ff404604c6
commit
93f3be957e
@ -69,4 +69,9 @@ enum SKIN_TYPE { SKIN_64x32, SKIN_64x64, SKIN_64x64_SLIM, SKIN_INVALID = 0xF0 };
|
||||
#define UInt16_MaxValue ((cc_uint16)65535)
|
||||
#define Int32_MinValue ((cc_int32)-2147483647L - (cc_int32)1L)
|
||||
#define Int32_MaxValue ((cc_int32)2147483647L)
|
||||
|
||||
/* Skins were moved to use Amazon S3, so link directly to avoid a pointless redirect */
|
||||
#define SKINS_SERVER "http://classicube.s3.amazonaws.com/skin/"
|
||||
#define UPDATES_SERVER "http://cs.classicube.net/client"
|
||||
#define SERVICES_SERVER "https://www.classicube.net/api"
|
||||
#endif
|
||||
|
@ -1033,9 +1033,6 @@ static void Http_WorkerStop(void) {
|
||||
/*########################################################################################################################*
|
||||
*----------------------------------------------------Http public api------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
/* Skins were moved to use Amazon S3, so link directly to avoid a pointless redirect */
|
||||
#define SKIN_SERVER "http://classicube.s3.amazonaws.com/skin/"
|
||||
|
||||
int Http_AsyncGetSkin(const cc_string* skinName) {
|
||||
cc_string url; char urlBuffer[URL_MAX_SIZE];
|
||||
String_InitArray(url, urlBuffer);
|
||||
@ -1043,7 +1040,7 @@ int Http_AsyncGetSkin(const cc_string* skinName) {
|
||||
if (Utils_IsUrlPrefix(skinName)) {
|
||||
String_Copy(&url, skinName);
|
||||
} else {
|
||||
String_Format1(&url, SKIN_SERVER "%s.png", skinName);
|
||||
String_Format1(&url, SKINS_SERVER "%s.png", skinName);
|
||||
}
|
||||
return Http_AsyncGetData(&url, false);
|
||||
}
|
||||
|
12
src/LWeb.c
12
src/LWeb.c
@ -247,7 +247,7 @@ static void GetTokenTask_Handle(cc_uint8* data, cc_uint32 len) {
|
||||
}
|
||||
|
||||
void GetTokenTask_Run(void) {
|
||||
static const cc_string url = String_FromConst("https://www.classicube.net/api/login");
|
||||
static const cc_string url = String_FromConst(SERVICES_SERVER "/login");
|
||||
static char tokenBuffer[STRING_SIZE];
|
||||
static char userBuffer[STRING_SIZE];
|
||||
if (GetTokenTask.Base.working) return;
|
||||
@ -304,7 +304,7 @@ static void SignInTask_Append(cc_string* dst, const char* key, const cc_string*
|
||||
}
|
||||
|
||||
void SignInTask_Run(const cc_string* user, const cc_string* pass, const cc_string* mfaCode) {
|
||||
static const cc_string url = String_FromConst("https://www.classicube.net/api/login");
|
||||
static const cc_string url = String_FromConst(SERVICES_SERVER "/login");
|
||||
static char userBuffer[STRING_SIZE];
|
||||
cc_string args; char argsBuffer[1024];
|
||||
if (SignInTask.Base.working) return;
|
||||
@ -391,7 +391,7 @@ void FetchServerTask_Run(const cc_string* hash) {
|
||||
LWebTask_Reset(&FetchServerTask.Base);
|
||||
ServerInfo_Init(&FetchServerTask.server);
|
||||
String_InitArray(url, urlBuffer);
|
||||
String_Format1(&url, "https://www.classicube.net/api/server/%s", hash);
|
||||
String_Format1(&url, SERVICES_SERVER "/server/%s", hash);
|
||||
|
||||
FetchServerTask.Base.Handle = FetchServerTask_Handle;
|
||||
FetchServerTask.Base.reqID = Http_AsyncGetDataEx(&url, false, NULL, NULL, &ccCookies);
|
||||
@ -436,7 +436,7 @@ static void FetchServersTask_Handle(cc_uint8* data, cc_uint32 len) {
|
||||
}
|
||||
|
||||
void FetchServersTask_Run(void) {
|
||||
static const cc_string url = String_FromConst("https://www.classicube.net/api/servers");
|
||||
static const cc_string url = String_FromConst(SERVICES_SERVER "/servers");
|
||||
if (FetchServersTask.Base.working) return;
|
||||
LWebTask_Reset(&FetchServersTask.Base);
|
||||
|
||||
@ -484,7 +484,7 @@ static void CheckUpdateTask_Handle(cc_uint8* data, cc_uint32 len) {
|
||||
}
|
||||
|
||||
void CheckUpdateTask_Run(void) {
|
||||
static const cc_string url = String_FromConst("http://cs.classicube.net/client/builds.json");
|
||||
static const cc_string url = String_FromConst(UPDATES_SERVER "/builds.json");
|
||||
if (CheckUpdateTask.Base.working) return;
|
||||
|
||||
LWebTask_Reset(&CheckUpdateTask.Base);
|
||||
@ -521,7 +521,7 @@ void FetchUpdateTask_Run(cc_bool release, cc_bool d3d9) {
|
||||
cc_string url; char urlBuffer[URL_MAX_SIZE];
|
||||
String_InitArray(url, urlBuffer);
|
||||
|
||||
String_Format2(&url, "http://cs.classicube.net/client/%c/%c",
|
||||
String_Format2(&url, UPDATES_SERVER "/%c/%c",
|
||||
release ? "release" : "latest",
|
||||
d3d9 ? Updater_D3D9 : Updater_OGL);
|
||||
|
||||
|
@ -422,12 +422,12 @@ cc_result File_OpenOrCreate(cc_file* file, const cc_string* path) {
|
||||
return File_Do(file, path, GENERIC_WRITE | GENERIC_READ, OPEN_ALWAYS);
|
||||
}
|
||||
|
||||
cc_result File_Read(cc_file file, cc_uint8* data, cc_uint32 count, cc_uint32* bytesRead) {
|
||||
cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) {
|
||||
BOOL success = ReadFile(file, data, count, bytesRead, NULL);
|
||||
return success ? 0 : GetLastError();
|
||||
}
|
||||
|
||||
cc_result File_Write(cc_file file, const cc_uint8* data, cc_uint32 count, cc_uint32* bytesWrote) {
|
||||
cc_result File_Write(cc_file file, const void* data, cc_uint32 count, cc_uint32* bytesWrote) {
|
||||
BOOL success = WriteFile(file, data, count, bytesWrote, NULL);
|
||||
return success ? 0 : GetLastError();
|
||||
}
|
||||
@ -535,12 +535,12 @@ cc_result File_OpenOrCreate(cc_file* file, const cc_string* path) {
|
||||
return File_Do(file, path, O_RDWR | O_CREAT);
|
||||
}
|
||||
|
||||
cc_result File_Read(cc_file file, cc_uint8* data, cc_uint32 count, cc_uint32* bytesRead) {
|
||||
cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) {
|
||||
*bytesRead = read(file, data, count);
|
||||
return *bytesRead == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Write(cc_file file, const cc_uint8* data, cc_uint32 count, cc_uint32* bytesWrote) {
|
||||
cc_result File_Write(cc_file file, const void* data, cc_uint32 count, cc_uint32* bytesWrote) {
|
||||
*bytesWrote = write(file, data, count);
|
||||
return *bytesWrote == -1 ? errno : 0;
|
||||
}
|
||||
|
@ -162,9 +162,9 @@ cc_result File_Open(cc_file* file, const cc_string* path);
|
||||
/* Attempts to open an existing or create a new file for reading and writing. */
|
||||
cc_result File_OpenOrCreate(cc_file* file, const cc_string* path);
|
||||
/* Attempts to read data from the file. */
|
||||
cc_result File_Read(cc_file file, cc_uint8* data, cc_uint32 count, cc_uint32* bytesRead);
|
||||
cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead);
|
||||
/* Attempts to write data to the file. */
|
||||
cc_result File_Write(cc_file file, const cc_uint8* data, cc_uint32 count, cc_uint32* bytesWrote);
|
||||
cc_result File_Write(cc_file file, const void* data, cc_uint32 count, cc_uint32* bytesWrote);
|
||||
/* Attempts to close the given file. */
|
||||
cc_result File_Close(cc_file file);
|
||||
/* Attempts to seek to a position in the given file. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user