From 2611a273ca5d66ed1c4de6f2824d85783494caa7 Mon Sep 17 00:00:00 2001 From: Brett Bergstrom Date: Sun, 28 Jun 2026 11:37:58 -0500 Subject: [PATCH] cum --- .gitmodules | 3 ++ amiga/main.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ deps/nanocobs | 1 + packet.h | 12 ++++++++ 4 files changed, 92 insertions(+) create mode 100644 .gitmodules create mode 100644 amiga/main.c create mode 160000 deps/nanocobs create mode 100644 packet.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fe4aee6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/nanocobs"] + path = deps/nanocobs + url = https://github.com/charlesnicholson/nanocobs.git diff --git a/amiga/main.c b/amiga/main.c new file mode 100644 index 0000000..e109904 --- /dev/null +++ b/amiga/main.c @@ -0,0 +1,76 @@ +#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(); + } +} diff --git a/deps/nanocobs b/deps/nanocobs new file mode 160000 index 0000000..09755c2 --- /dev/null +++ b/deps/nanocobs @@ -0,0 +1 @@ +Subproject commit 09755c2abb4f2f63f33c2e88d8d06563971639bd diff --git a/packet.h b/packet.h new file mode 100644 index 0000000..fa52e26 --- /dev/null +++ b/packet.h @@ -0,0 +1,12 @@ +#ifndef AMIPATHY_PACKET_H +#define AMIPATHY_PACKET_H + +struct packet { + uint8_t magic; + uint16_t x, y; + uint8_t mouse0; + uint8_t mouse1; + uint16_t sum; +}; + +#endif //AMIPATHY_PACKET_H \ No newline at end of file