mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
C client: Fix skins using all 64 characters not working
This commit is contained in:
parent
446098e82c
commit
5f12a5b869
@ -309,7 +309,6 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
|
|
||||||
struct Portion { public int Beg, Len, LineBeg, LineLen; }
|
struct Portion { public int Beg, Len, LineBeg, LineLen; }
|
||||||
unsafe int Reduce(char* chars, int target, Portion* portions) {
|
unsafe int Reduce(char* chars, int target, Portion* portions) {
|
||||||
Portion* start = portions;
|
|
||||||
int charsLen = 0, count = 0;
|
int charsLen = 0, count = 0;
|
||||||
int* begs = stackalloc int[lines.Length];
|
int* begs = stackalloc int[lines.Length];
|
||||||
int* ends = stackalloc int[lines.Length];
|
int* ends = stackalloc int[lines.Length];
|
||||||
|
@ -18,10 +18,7 @@ namespace ClassicalSharp.Map {
|
|||||||
public WorldEnv Env;
|
public WorldEnv Env;
|
||||||
public Guid Uuid;
|
public Guid Uuid;
|
||||||
public string TextureUrl = null;
|
public string TextureUrl = null;
|
||||||
|
public World(Game game) { Env = new WorldEnv(); }
|
||||||
public World(Game game) {
|
|
||||||
Env = new WorldEnv(game);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
Env.Reset();
|
Env.Reset();
|
||||||
|
@ -54,12 +54,7 @@ namespace ClassicalSharp.Map {
|
|||||||
|
|
||||||
public float SkyboxHorSpeed, SkyboxVerSpeed;
|
public float SkyboxHorSpeed, SkyboxVerSpeed;
|
||||||
public bool ExpFog;
|
public bool ExpFog;
|
||||||
|
public WorldEnv() { ResetLight(); }
|
||||||
Game game;
|
|
||||||
public WorldEnv(Game game) {
|
|
||||||
this.game = game;
|
|
||||||
ResetLight();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
EdgeHeight = -1; SidesOffset = -2; CloudHeight = -1;
|
EdgeHeight = -1; SidesOffset = -2; CloudHeight = -1;
|
||||||
|
@ -15,8 +15,6 @@ namespace ClassicalSharp.Textures {
|
|||||||
/// <summary> Extracts resources from a .zip texture pack. </summary>
|
/// <summary> Extracts resources from a .zip texture pack. </summary>
|
||||||
public sealed class TexturePack {
|
public sealed class TexturePack {
|
||||||
|
|
||||||
static Game game;
|
|
||||||
|
|
||||||
public static void ExtractDefault(Game game) {
|
public static void ExtractDefault(Game game) {
|
||||||
ExtractZip(game.DefaultTexturePack, game);
|
ExtractZip(game.DefaultTexturePack, game);
|
||||||
game.World.TextureUrl = null;
|
game.World.TextureUrl = null;
|
||||||
@ -46,7 +44,6 @@ namespace ClassicalSharp.Textures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ExtractZip(Stream stream, Game game) {
|
static void ExtractZip(Stream stream, Game game) {
|
||||||
TexturePack.game = game;
|
|
||||||
Events.RaiseTexturePackChanged();
|
Events.RaiseTexturePackChanged();
|
||||||
if (game.Graphics.LostContext) return;
|
if (game.Graphics.LostContext) return;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ struct AsyncRequest {
|
|||||||
UInt32 ResultSize;
|
UInt32 ResultSize;
|
||||||
|
|
||||||
UInt64 LastModified; /* Time item cached at (if at all) */
|
UInt64 LastModified; /* Time item cached at (if at all) */
|
||||||
UInt8 Etag[STRING_SIZE]; /* ETag of cached item (if any) */
|
char Etag[STRING_SIZE]; /* ETag of cached item (if any) */
|
||||||
UInt8 RequestType;
|
UInt8 RequestType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -897,8 +897,11 @@ void Http_Init(void) {
|
|||||||
|
|
||||||
static ReturnCode Http_Make(struct AsyncRequest* req, HINTERNET* handle) {
|
static ReturnCode Http_Make(struct AsyncRequest* req, HINTERNET* handle) {
|
||||||
String url = String_FromRawArray(req->URL);
|
String url = String_FromRawArray(req->URL);
|
||||||
|
WCHAR urlStr[300]; Platform_ConvertString(urlStr, &url);
|
||||||
|
|
||||||
char headersBuffer[STRING_SIZE * 2] = { 0 };
|
char headersBuffer[STRING_SIZE * 2] = { 0 };
|
||||||
String headers = String_FromArray(headersBuffer);
|
String headers = String_FromArray(headersBuffer);
|
||||||
|
WCHAR headersStr[STRING_SIZE * 2 + 1];
|
||||||
|
|
||||||
/* https://stackoverflow.com/questions/25308488/c-wininet-custom-http-headers */
|
/* https://stackoverflow.com/questions/25308488/c-wininet-custom-http-headers */
|
||||||
if (req->Etag[0] || req->LastModified) {
|
if (req->Etag[0] || req->LastModified) {
|
||||||
@ -917,7 +920,13 @@ static ReturnCode Http_Make(struct AsyncRequest* req, HINTERNET* handle) {
|
|||||||
String_AppendConst(&headers, "\r\n\r\n");
|
String_AppendConst(&headers, "\r\n\r\n");
|
||||||
} else { headers.buffer = NULL; }
|
} else { headers.buffer = NULL; }
|
||||||
|
|
||||||
*handle = InternetOpenUrlA(hInternet, url.buffer, headers.buffer, headers.length,
|
Int32 i;
|
||||||
|
for (i = 0; i < headers.length; i++) {
|
||||||
|
headersStr[i] = headers.buffer[i];
|
||||||
|
}
|
||||||
|
headersStr[headers.length] = '\0';
|
||||||
|
|
||||||
|
*handle = InternetOpenUrlW(hInternet, urlStr, headersStr, headers.length,
|
||||||
INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_UI | INTERNET_FLAG_RELOAD, 0);
|
INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_UI | INTERNET_FLAG_RELOAD, 0);
|
||||||
return Win_Return(*handle);
|
return Win_Return(*handle);
|
||||||
}
|
}
|
||||||
@ -1080,10 +1089,12 @@ static size_t Http_GetData(char *buffer, size_t size, size_t nitems, struct Asyn
|
|||||||
ReturnCode Http_Do(struct AsyncRequest* req, volatile Int32* progress) {
|
ReturnCode Http_Do(struct AsyncRequest* req, volatile Int32* progress) {
|
||||||
curl_easy_reset(curl);
|
curl_easy_reset(curl);
|
||||||
String url = String_FromRawArray(req->URL);
|
String url = String_FromRawArray(req->URL);
|
||||||
|
char urlStr[600]; Platform_ConvertString(urlStr, &url);
|
||||||
|
|
||||||
struct curl_slist* list = Http_Make(req);
|
struct curl_slist* list = Http_Make(req);
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url.buffer);
|
curl_easy_setopt(curl, CURLOPT_URL, urlStr);
|
||||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, PROGRAM_APP_NAME);
|
curl_easy_setopt(curl, CURLOPT_USERAGENT, PROGRAM_APP_NAME);
|
||||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user