mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-11-15 01:27:36 +01:00
44 lines
782 B
C
44 lines
782 B
C
|
#pragma once
|
||
|
|
||
|
#include <windows.h>
|
||
|
|
||
|
#include <stddef.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#include "hook/iobuf.h"
|
||
|
|
||
|
struct sg_header {
|
||
|
uint8_t frame_len;
|
||
|
uint8_t addr;
|
||
|
uint8_t seq_no;
|
||
|
uint8_t cmd;
|
||
|
};
|
||
|
|
||
|
struct sg_req_header {
|
||
|
struct sg_header hdr;
|
||
|
uint8_t payload_len;
|
||
|
};
|
||
|
|
||
|
struct sg_resp_header {
|
||
|
struct sg_header hdr;
|
||
|
uint8_t status;
|
||
|
uint8_t payload_len;
|
||
|
};
|
||
|
|
||
|
typedef HRESULT (*sg_dispatch_fn_t)(
|
||
|
void *ctx,
|
||
|
const void *req,
|
||
|
void *resp);
|
||
|
|
||
|
void sg_req_transact(
|
||
|
struct iobuf *resp_frame,
|
||
|
const uint8_t *req_bytes,
|
||
|
size_t req_nbytes,
|
||
|
sg_dispatch_fn_t dispatch,
|
||
|
void *ctx);
|
||
|
|
||
|
void sg_resp_init(
|
||
|
struct sg_resp_header *resp,
|
||
|
const struct sg_req_header *req,
|
||
|
size_t payload_len);
|