Permalink
Browse files

fix compile errors in launcher

  • Loading branch information...
UnknownShadow200 committed Dec 7, 2018
1 parent 8066a76 commit 32fffb895d56dea376373f43bcb987b55c20cd00
Showing with 208 additions and 105 deletions.
  1. +1 −4 src/AsyncDownloader.c
  2. +3 −0 src/AsyncDownloader.h
  3. +1 −1 src/Constants.h
  4. +2 −8 src/Game.c
  5. +1 −1 src/Game.h
  6. +17 −2 src/LScreens.c
  7. +4 −0 src/LScreens.h
  8. +1 −1 src/LWeb.c
  9. +76 −2 src/LWeb.h
  10. +82 −72 src/Launcher.c
  11. +2 −12 src/Launcher.h
  12. +3 −1 src/Platform.c
  13. +1 −1 src/Program.c
  14. +12 −0 src/Window.c
  15. +2 −0 src/Window.h
@@ -74,10 +74,7 @@ static struct AsyncRequestList async_processed;
static String async_skinServer = String_FromConst("http://static.classicube.net/skins/");
static struct AsyncRequest async_curRequest;
static volatile int async_curProgress = ASYNC_PROGRESS_NOTHING;
/* TODO: Implement these */
static bool ManageCookies;
static bool KeepAlive;
/* TODO: Connection pooling */
bool AsyncDownloader_Cookies;
static void AsyncDownloader_Add(const String* url, bool priority, const String* id, uint8_t type, TimeMS* lastModified, const String* etag, const String* data) {
struct AsyncRequest req = { 0 };
@@ -8,6 +8,9 @@
struct IGameComponent;
struct ScheduledTask;
extern struct IGameComponent AsyncDownloader_Component;
/* TODO: Implement these */
extern bool AsyncDownloader_Cookies;
/* TODO: Connection pooling */
enum REQUEST_TYPE { REQUEST_TYPE_DATA, REQUEST_TYPE_CONTENT_LENGTH };
enum AsyncProgress {
@@ -46,7 +46,7 @@ enum FACE_CONSTS {
};
enum SKIN_TYPE { SKIN_64x32, SKIN_64x64, SKIN_64x64_SLIM, SKIN_INVALID = 0xF0 };
enum FONT_STYLE { FONT_STYLE_NORMAL, FONT_STYLE_BOLD, FONT_STYLE_UNDERLINE };
enum FONT_STYLE { FONT_STYLE_NORMAL, FONT_STYLE_BOLD, FONT_STYLE_ITALIC, FONT_STYLE_UNDERLINE };
#define DRAWER2D_MAX_COLS 256
#define UInt8_MaxValue ((uint8_t)255)
@@ -702,17 +702,11 @@ void Game_Free(void* obj) {
Options_Save();
}
void Game_Run(int width, int height, const String* title, struct DisplayDevice* device) {
struct GraphicsMode mode;
void Game_Run(int width, int height, const String* title) {
uint64_t lastRender, render;
double time;
int x, y;
x = device->Bounds.X + (device->Bounds.Width - width) / 2;
y = device->Bounds.Y + (device->Bounds.Height - height) / 2;
GraphicsMode_MakeDefault(&mode);
Window_Create(x, y, width, height, &mode);
Window_CreateSimple(width, height);
Window_SetTitle(title);
Window_SetVisible(true);
@@ -96,5 +96,5 @@ void Game_UpdateClientSize(void);
void Game_SetFpsLimit(enum FpsLimit method);
float Game_CalcLimitMillis(enum FpsLimit method);
void Game_Run(int width, int height, const String* title, struct DisplayDevice* device);
void Game_Run(int width, int height, const String* title);
#endif
@@ -18,6 +18,18 @@ static void LScreen_DrawAll(struct LScreen* s) {
}
}
/*static void LScreen_KeyDown(struct LScreen* s, Key key) {
}
static void LScreen_MouseDown(struct LScreen* s, MouseButton btn) {
}
static void LScreen_MouseMove(struct LScreen* s, int deltaX, int deltaY) {
}*/
static void LScreen_HoverWidget(struct LScreen* s, struct LWidget* w) {
if (!w) return;
w->Hovered = true;
@@ -38,6 +50,9 @@ CC_NOINLINE static void LScreen_Reset(struct LScreen* s) {
s->DrawAll = LScreen_DrawAll;
s->Tick = LScreen_NullFunc;
s->OnDisplay = LScreen_NullFunc;
s->KeyDown = LScreen_KeyDown;
s->MouseDown = LScreen_MouseDown;
s->MouseMove = LScreen_MouseMove;
s->HoverWidget = LScreen_HoverWidget;
s->UnhoverWidget = LScreen_UnhoverWidget;
@@ -152,7 +167,7 @@ static void UseModeEnhanced(void* w, int x, int y) { ChooseMode_Click(false, f
static void UseModeClassicHax(void* w, int x, int y) { ChooseMode_Click(true, true); }
static void UseModeClassic(void* w, int x, int y) { ChooseMode_Click(true, false); }
static void ChooseModeScreenScreen_InitWidgets(struct ChooseModeScreen* s) {
static void ChooseModeScreen_InitWidgets(struct ChooseModeScreen* s) {
struct LScreen* s_ = (struct LScreen*)s;
int middle = Game_Width / 2;
@@ -256,7 +271,7 @@ static void DirectConnectScreen_Save(const String* user, const String* mppass, c
Options_Set("launcher-dc-ip", ip);
Options_Set("launcher-dc-port", port);
Launcher_SaveSecureOpt("launcher-dc-mppass", mppass, user);
Options_Save();
Launcher_SaveOptions = true;
}
static void StartClient(void* w, int x, int y) {
@@ -2,6 +2,7 @@
#define CC_LSCREENS_H
#include "AsyncDownloader.h"
#include "String.h"
#include "Input.h"
/* Implements screens/menus for the launcher.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
@@ -17,6 +18,9 @@ typedef void (*LWidget_Func)(struct LScreen* s, struct LWidget* w);
LScreen_Func DrawAll; /* Redraws all widgets. */ \
LScreen_Func Tick; /* Repeatedly called multiple times every second. */ \
LScreen_Func OnDisplay; /* Called when framebuffer is about to be displayed. */ \
void (*KeyDown)(struct LScreen* s, Key key); \
void (*MouseDown)(struct LScreen* s, MouseButton btn); \
void (*MouseMove)(struct LScreen* s, int deltaX, int deltaY); \
LWidget_Func HoverWidget; /* Called when mouse is moved over a given widget. */ \
LWidget_Func UnhoverWidget; /* Called when the mouse is moved away from a previously hovered widget. */ \
struct LWidget* OnEnterWidget; /* Default widget to auto-click when Enter is pressed. Can be NULL. */ \
@@ -8,7 +8,7 @@ static void LWebTask_Reset(struct LWebTask* task) {
task->Start = DateTime_CurrentUTC_MS();
}
void LWebTask_StartAsync(struct LWebTask* task) {
static void LWebTask_StartAsync(struct LWebTask* task) {
LWebTask_Reset(task);
task->Begin(task);
}
@@ -6,6 +6,14 @@
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
/* Represents all known details about a server. */
struct ServerListEntry {
String Hash, Name, Flag, IP, Port, Mppass, Software;
int Players, MaxPlayers, Uptime;
bool Featured;
char _Buffer[7][STRING_SIZE];
};
struct LWebTask;
struct LWebTask {
/* Whether the task has finished executing. */
@@ -26,7 +34,73 @@ struct LWebTask {
/* Called when task successfully downloaded/uploaded data. */
void (*Handle)(struct LWebTask* task, uint8_t* data, uint32_t len);
};
void LWebTask_StartAsync(struct LWebTask* task);
void LWebTask_Tick(struct LWebTask* task);
extern struct GetCSRFTokenTaskData {
struct LWebTask Base;
/* Random CSRF token for logging in. */
String Token;
} GetCSRFTokenTask;
void GetCSRFTokenTask_Run(void);
extern struct SignInTaskData {
struct LWebTask Base;
/* Username to sign in as. Changed to case correct username. */
String Username;
/* If sign in fails, the reason as to why. */
String Error;
} SignInTask;
void SignInTask_Run(const String* user, const String* pass);
extern struct FetchServerData {
struct LWebTask Base;
/* Details about the given server on success. */
struct ServerListEntry Server;
} FetchServerTask;
void FetchServerTask_Run(const String* hash);
extern struct FetchServersData {
struct LWebTask Base;
/* List of all public servers on classicube.net server list. */
struct ServerListEntry* Servers;
/* Number of public servers that have been fetched. */
int NumServers;
} FetchServersTask;
void FetchServersTask_Run(void);
extern struct UpdateCheckTaskData {
struct LWebTask Base;
/* Timestamp latest commit/dev build and release were at. */
TimeMS DevTimestamp, ReleaseTimestamp;
/* Version of latest release. */
String LatestRelease;
} UpdateCheckTask; /* TODO: Work out the JSON for this.. */
void UpdateCheckTask_Run(void);
extern struct UpdateDownloadTaskData {
struct LWebTask Base;
/* The raw downloaded executable. */
uint8_t* Data;
/* Size of data in bytes. */
uint32_t DataLen;
} UpdateDownloadTask;
void UpdateDownloadTask_Run(const String* file);
extern struct FetchFlagsTaskData {
struct LWebTask Base;
/* Number of flags that have been downloaded. */
int NumDownloaded;
/* Raw pixels for each downloaded flag. */
Bitmap* Bitmaps;
/* Name for each downloaded flag.*/
String* Names;
} FetchFlagsTask;
void FetchFlagsTask_Run(void);
void FetchFlagsTask_Add(const String* name);
#endif
Oops, something went wrong.

0 comments on commit 32fffb8

Please sign in to comment.