Add the STR RPC to overlord and game code (#134)

* work in progress streaming rpc, simple test is working

* actually add the test

* debug windows failure

* windows fix maybe

* windows 2

* use str-load-status

* update types
This commit is contained in:
water111
2020-11-22 12:59:55 -05:00
committed by GitHub
parent 460ec874bb
commit 19b8bb81c9
27 changed files with 749 additions and 126 deletions
+3
View File
@@ -0,0 +1,3 @@
#pragma once
constexpr int SECTOR_SIZE = 0x800; // media sector size
+37
View File
@@ -0,0 +1,37 @@
#pragma once
#include "common/common_types.h"
#include "game/common/overlord_common.h"
constexpr int STR_RPC_ID = 0xdeb5;
constexpr int STR_RPC_CHANNEL = 4;
struct RPC_Str_Cmd {
u16 rsvd; // 0, seems unused
u16 result; // 2, return code. see STR_RPC_RESULT_XXX
u32 ee_addr; // 4, GOAL address to load to.
s32 chunk_id; // 8, chunk ID for chunked file. Use -1 to load a non-chunked file, which gets the
// whole file.
u32 length; // 12, length that was actually loaded
char name[64]; // file name
};
constexpr int STR_RPC_RESULT_ERROR = 1;
constexpr int STR_RPC_RESULT_DONE = 0;
// maximum number of chunks in a chunked file.
constexpr int SECTOR_TABLE_SIZE = 64;
// the header of a chunked file
struct StrFileHeader {
u32 sectors[SECTOR_TABLE_SIZE]; // start of chunk, in sectors. including this sector.
u32 sizes[SECTOR_TABLE_SIZE]; // size of chunk, in bytes. always an integer number of sectors
};
// the first sector of a chunked file.
struct StrFileHeaderSector : StrFileHeader {
u32 pad[512 - 128]; // all zero
};
static_assert(sizeof(StrFileHeader) == 0x200, "Sector header size");
static_assert(sizeof(StrFileHeaderSector) == SECTOR_SIZE, "Sector header size");