BuGS/BuGS/globalScores.c

82 lines
1.5 KiB
C

/*
* globalScores.c
* BuGS
*
* Created by Jeremy Rand on 2021-05-23.
* Copyright © 2021 Jeremy Rand. All rights reserved.
*/
#include <misctool.h>
#include <stdint.h>
#include <types.h>
#include "globalScores.h"
#define REQUEST_TYPE_GET_HIGH_SCORES 0
#define REQUEST_TYPE_SET_SCORE 1
#define RESPONSE_TYPE_HELLO 0
#define RESPONSE_TYPE_SCORES 1
#define RESPONSE_TYPE_STATUS 2
typedef struct tSessionSecrets {
uint32_t secret;
uint32_t nonce;
} tSessionSecrets;
typedef struct tHighScoreRequest {
uint16_t requestType;
} tHighScoreRequest;
typedef struct tHighScoreRequestWithHash {
tHighScoreRequest highScoreRequest;
uint8_t md5Digest[16];
} tHighScoreRequestWithHash;
typedef struct tSetHighScoreRequest {
uint16_t requestType;
char who[4];
uint32_t score;
Boolean is60Hz;
} tSetHighScoreRequest;
typedef struct tSetHighScoreRequestWithHash {
tSetHighScoreRequest setHighScoreRequest;
uint8_t md5Digest[16];
} tSetHighScoreRequestWithHash;
typedef struct tHelloResponse {
uint16_t responseType;
uint32_t nonce;
} tHelloResponse;
typedef struct tScoresResponse {
uint16_t responseType;
tHighScore highScores[10];
} tScoresResponse;
typedef struct tStatusResponse {
uint16_t responseType;
Boolean success;
} tStatusResponse;
#if 0
Word blah(void)
{
// This is how to read the 50 or 60 Hz indicator:
// 0 is 60 Hz
// 1 is 50 Hz
return ReadBParam(hrtz50or60);
}
#endif