cum
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "deps/nanocobs"]
|
||||
path = deps/nanocobs
|
||||
url = https://github.com/charlesnicholson/nanocobs.git
|
||||
76
amiga/main.c
Normal file
76
amiga/main.c
Normal 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
1
deps/nanocobs
vendored
Submodule
Submodule deps/nanocobs added at 09755c2abb
Reference in New Issue
Block a user