This commit is contained in:
2026-06-28 11:37:58 -05:00
commit 2611a273ca
4 changed files with 92 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "deps/nanocobs"]
path = deps/nanocobs
url = https://github.com/charlesnicholson/nanocobs.git

76
amiga/main.c Normal file
View File

@@ -0,0 +1,76 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <intuition/screens.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <proto/dos.h>
#include <dos/dos.h>
#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();
}
}

1
deps/nanocobs vendored Submodule

Submodule deps/nanocobs added at 09755c2abb

12
packet.h Normal file
View File

@@ -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