diff --git a/include/msgba/core_controller.h b/include/msgba/core_controller.h index bdede58..2515c29 100644 --- a/include/msgba/core_controller.h +++ b/include/msgba/core_controller.h @@ -9,28 +9,72 @@ struct msMultiplayerController; +/** + * The struct representing the controller for a single mgba instance. + */ struct msCoreController { + //! The multiplayer instance. (Unused currently.) struct msMultiplayerController *multiplayer; + //! The mCoreThread containing the current game. struct mCoreThread threadContext; + //! The output image buffer. color_t *outputBuffer; + //! The width of the buffer. unsigned int stride; + //! The savestate to load on boot. struct VFile *saveState; }; +/** + * Loads a game and returns a msCoreController + * @param rom The byte array of the rom. + * @param rom_len The size of the previous parameter. + * @param state The savestate byte array. + * @param state_len The size of the savestate. + * @param data The session object. + * @return The created controller. + */ struct msCoreController * msCoreControllerLoadGame (const unsigned char *rom, size_t rom_len, const unsigned char *state, size_t state_len, struct msClientConnectionData *const data); +/** + * Ends the life of msCoreController. + * @param controllerPtr The pointer to the pointer to msCoreController. + */ void -msCoreControllerDestroy(struct msCoreController **controller_ptr); +msCoreControllerDestroy(struct msCoreController **controllerPtr); +/** + * Creates a new msCoreController. + * @param core The mCore to load in the threadContext. + * @param data The current session. + * @return The created controller. + */ struct msCoreController * msCoreControllerNew (struct mCore *core, struct msClientConnectionData *const data); + +/** + * Starts the thread for this coreController + * @param coreController This object. + */ void -msCoreControllerThreadStart (struct msCoreController *const core_controller); +msCoreControllerThreadStart (struct msCoreController *const coreController); + +/** + * Sets a callback to be executed on every frame. + * @param self This object. + * @param callback The subroutine to execute. + */ void msCoreControllerSetFrameCallback(struct msCoreController *const self, void(*callback)(struct mCoreThread *)); + +/** + * Sets a subroutine to be executed on the start of the threadContext. + * @param self This object. + * @param callback The subroutine to be executed. + */ void msCoreControllerSetStartCallback(struct msCoreController *const self, void(*callback)(struct mCoreThread *)); #endif diff --git a/include/msgba/packet/hello.h b/include/msgba/packet/hello.h index e43ecd2..2e5dc79 100644 --- a/include/msgba/packet/hello.h +++ b/include/msgba/packet/hello.h @@ -46,11 +46,11 @@ msPacketHelloHandle(const struct msPacket *packet, struct msPacketHello *hello, /** * Retrieves the msPacketHello contained in the packet raw_data. * @param packet The packet containing msPacketHello, should have PACKET_GET_HELLO as its id. - * @param client_fd The source of this packet. + * @param clientFd The source of this packet. * @param data This session. * @return The success status. */ bool -msPacketHelloGet(const struct msPacket *packet, int client_fd, +msPacketHelloGet(const struct msPacket *packet, int clientFd, struct msClientConnectionData *const data); #endif