/* =========================================================================== IceTech GPL Source Code Copyright (C) 2026 Justin Marshall This file is part of the IceTech GPL Source Code. =========================================================================== */ #ifndef __MINIGAME_HOST_H__ #define __MINIGAME_HOST_H__ #include "Minigame_public.h" class idMinigameInstance { public: idMinigameInstance(); ~idMinigameInstance(); bool Start( const char *moduleName, const char *imageName, const char *commandLine ); void Shutdown(); void SetActive( bool active ); void QueueEvent( const sysEvent_t *event, int time ); bool UploadFramebuffer(); const char * GetImageName() const { return imageName.c_str(); } bool IsStarted() const { return instance != NULL; } bool HasFailed() const { return failed; } private: static unsigned int ThreadProc( void *parm ); unsigned int RunThread(); void CopyFramebuffer( const iceMinigameFramebuffer_t &source ); void ClearFramebuffer(); void Lock(); void Unlock(); static void PrintCallback( void *userData, const char *text ); static void SubmitAudioCallback( void *userData, const iceMinigameAudioBuffer_t *audio ); INT_PTR moduleHandle; iceMinigameExport_t exports; iceMinigameImport_t imports; iceMinigameInstance_t * instance; idStr moduleName; idStr imageName; idStr commandLine; idStr resolvedPath; idStr importBasePath; idStr importSavePath; xthreadInfo threadInfo; CRITICAL_SECTION criticalSection; bool threadStarted; volatile bool shutdownRequested; bool active; bool activeSent; bool failed; bool frameReady; byte * framebuffer; int framebufferWidth; int framebufferHeight; int framebufferBytes; idList pendingEvents; }; #endif // __MINIGAME_HOST_H__