#include #include #include #include #include #include #include #include #include #include #include #include #include #include "../deps/nanocobs/cobs.h" #include "../packet.h" struct IntuitionBase* Intuit; struct packet ReadPacket() { struct packet p; // todo return p; } int main() { printf("Amipathy Server v1\n" "by bonkmaykr/madarao\n" ); struct IOStdReq* InputIO; struct MsgPort* InputMP; struct InputEvent* FakeEvent; struct IEPointerPixel* NeoPix; struct Screen* PubScreen; // ReSharper disable CppUsingResultOfAssignmentAsCondition if ((InputMP = CreateMsgPort()) && (FakeEvent = AllocMem(sizeof(struct InputEvent),MEMF_PUBLIC)) && (NeoPix = AllocMem(sizeof(struct IEPointerPixel),MEMF_PUBLIC)) && (InputIO = CreateIORequest(InputMP,sizeof(struct IOStdReq))) && (!OpenDevice("input.device",NULL, (struct IORequest*)InputIO,NULL)) && (Intuit = (struct IntuitionBase*)OpenLibrary("intuition.library",36L))) { while (true) { PubScreen = (struct Screen*)LockPubScreen(NULL); if (!PubScreen) goto stall; struct packet p = ReadPacket(); NeoPix->iepp_Screen = PubScreen; NeoPix->iepp_Position.X = p.x; NeoPix->iepp_Position.Y = p.y; FakeEvent->ie_EventAddress = (APTR)NeoPix; FakeEvent->ie_NextEvent = NULL; FakeEvent->ie_Class = IECLASS_NEWPOINTERPOS; FakeEvent->ie_SubClass = IESUBCLASS_PIXEL; FakeEvent->ie_Code = IECODE_NOBUTTON; FakeEvent->ie_Qualifier = NULL; InputIO->io_Data = (APTR)FakeEvent; InputIO->io_Length = sizeof(struct InputEvent); InputIO->io_Command = IND_WRITEEVENT; DoIO((struct IORequest *)InputIO); UnlockPubScreen(NULL, PubScreen); PubScreen = NULL; stall: Delay(1); } } else { printf("init failed\n" "%p\n%p\n%p\n%p\n%p\n", InputIO, InputMP, FakeEvent, NeoPix, Intuit ); abort(); } }