Bump the version to 1.9 since this is work towards v2.0. Add the structs for the messages to a server side high score list. Add the hash tool to the boot image for network testing. The requests will use hashes to validate that they come from the game.

This commit is contained in:
Jeremy Rand 2021-05-28 00:03:04 -04:00
parent 701d9fd312
commit 8d95d0a674
7 changed files with 114 additions and 12 deletions

View File

@ -20,6 +20,7 @@
9D1716A52491C49300C83148 /* system601.2mg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A42491C49300C83148 /* system601.2mg */; };
9D1716A72491C49300C83148 /* tail.mk in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A62491C49300C83148 /* tail.mk */; };
9D1716AA2491C49300C83148 /* BuGS.xcscheme in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A92491C49300C83148 /* BuGS.xcscheme */; };
9DB90E80265AD04A003461C1 /* globalScores.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DB90E7F265AD04A003461C1 /* globalScores.c */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -122,6 +123,8 @@
9DB1505324C9E54C00558B87 /* gameSpider.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameSpider.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9DB1505424D3BF6C00558B87 /* gameSegments.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameSegments.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9DB1505524D3BFCE00558B87 /* global.macros */ = {isa = PBXFileReference; lastKnownFileType = text; path = global.macros; sourceTree = "<group>"; };
9DB90E7E265AD04A003461C1 /* globalScores.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = globalScores.h; sourceTree = "<group>"; };
9DB90E7F265AD04A003461C1 /* globalScores.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = globalScores.c; sourceTree = "<group>"; };
9DC4D7BD24B7652100BACF4B /* ship.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ship.s; sourceTree = "<group>"; };
9DC4D7BE24B80C9600BACF4B /* shot.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = shot.s; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -200,6 +203,8 @@
children = (
9D17168E2491C49300C83148 /* main.c */,
9D1716902491C49300C83148 /* main.h */,
9DB90E7E265AD04A003461C1 /* globalScores.h */,
9DB90E7F265AD04A003461C1 /* globalScores.c */,
9D8FFC602491CA28005C9327 /* game.s */,
9D8FFC612491CAF0005C9327 /* game.h */,
9DB1505024C3801100558B87 /* gameFlea.s */,
@ -390,6 +395,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9DB90E80265AD04A003461C1 /* globalScores.c in Sources */,
9D1716942491C49300C83148 /* Makefile in Sources */,
9D17168F2491C49300C83148 /* main.c in Sources */,
);

View File

@ -7,7 +7,7 @@
<key>Binary.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>3</integer>
</dict>
<key>BuGS.xcscheme_^#shared#^_</key>
<dict>
@ -22,7 +22,7 @@
<key>doNotBuild.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>1</integer>
</dict>
</dict>
</dict>

81
BuGS/globalScores.c Normal file
View File

@ -0,0 +1,81 @@
/*
* 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

21
BuGS/globalScores.h Normal file
View File

@ -0,0 +1,21 @@
/*
* globalScores.h
* BuGS
*
* Created by Jeremy Rand on 2021-05-23.
* Copyright © 2021 Jeremy Rand. All rights reserved.
*/
#ifndef _GUARD_PROJECTBuGS_FILEglobalScores_
#define _GUARD_PROJECTBuGS_FILEglobalScores_
typedef struct tHighScore
{
char scoreText[10];
char who[4];
unsigned long score;
} tHighScore;
#endif /* define _GUARD_PROJECTBuGS_FILEglobalScores_ */

View File

@ -20,6 +20,7 @@
#include "main.h"
#include "game.h"
#include "globalScores.h"
#include "tileData.h"
@ -33,13 +34,6 @@
/* Typedefs */
typedef struct tHighScore
{
char scoreText[10];
char who[4];
unsigned long score;
} tHighScore;
typedef struct tSettingsData
{
char magic[4];

View File

@ -62,9 +62,9 @@ resource rUpdateInfo (UPDATE_INFO, $0000) {
resource rVersion (1) {
{
1, /* Major version number in BCD */
0, /* Minor version number in BCD */
1, /* Bug version number in BCD */
release, /* Development phase */
9, /* Minor version number in BCD */
0, /* Bug version number in BCD */
alpha, /* Development phase */
0 /* Release number */
},
verUS,

Binary file not shown.