jak-project/common/listener_common.h
2020-08-22 22:30:12 -04:00

60 lines
1.8 KiB
C++

/*!
* @file listener_common.h
* Common types shared between the compiler and the runtime for the listener connection.
*/
#ifndef JAK1_LISTENER_COMMON_H
#define JAK1_LISTENER_COMMON_H
#include "common/common_types.h"
/*!
* Header of a DECI2 protocol message
* TODO - there are other copies of this somewhere
*/
struct Deci2Header {
u16 len; //! size of data following header
u16 rsvd; //! zero, used internally by runtime.
u16 proto; //! protocol identification number
u8 src; //! identification code of sender
u8 dst; //! identification code of recipient
};
/*!
* Type of message sent to compiler
*/
enum class ListenerMessageKind : u16 {
MSG_ACK = 0, //! Acknowledge a compiler message
MSG_OUTPUT = 1, //! Send output buffer data
MSG_PRINT = 2, //! Send print buffer data
MSG_INVALID = 24
};
/*!
* Type of message sent from compiler
*/
enum ListenerToTargetMsgKind {
LTT_MSG_POKE = 1, //! "Poke" the game and have it flush buffers
LTT_MSG_INSEPCT = 5, //! Inspect an object
LTT_MSG_PRINT = 6, //! Print an object
LTT_MSG_PRINT_SYMBOLS = 7, //! Print all symbols
LTT_MSG_RESET = 8, //! Reset the game
LTT_MSG_CODE = 9 //! Send code to patch into the game
};
/*!
* The full header of a listener message, including the Deci2Header
* TODO - there are other copies of this somewhere
*/
struct ListenerMessageHeader {
Deci2Header deci2_header; //! The header used for DECI2 communication
ListenerMessageKind msg_kind; //! GOAL Listener message kind
u16 u6; //! Unknown
u32 msg_size; //! Size of data after this header
u64 u8; //! Unknown
};
constexpr int DECI2_PORT = 8112; // TODO - is this a good choise?
#endif // JAK1_LISTENER_COMMON_H