diff --git a/README.md b/README.md index 9a335d2..5d2e479 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,24 @@ -pacman -====== +# Pacman-libpayload -ASCII Pacman game, written with curses +ASCII Pacman game, written with curses, ported to libpayload to be used +with coreboot. -Use the keys: +## Building -x - left -c - right -k - up -m - down +* Build libpayload +* Start from `coreboot/payloads/pacman` or edit the `lpgcc` path in Makefile +* Run `make` +* Build coreboot with `An ELF executable payload`, pointing to the built +`pacman` file. So far, it's only been tested in qemu. +## Playing + +Run `qemu-kvm -bios coreboot.rom -M q35`. Use the keys: + +``` + x - left + c - right + k - up + m - down +``` +to move. diff --git a/porting-journal.md b/porting-journal.md deleted file mode 100644 index eda1f22..0000000 --- a/porting-journal.md +++ /dev/null @@ -1,6 +0,0 @@ -## TODO - -* check if the sleep replacement translates well to the same time -intervals -* remove the "pactext" file operation, store the game state entirely in -RAM **OR** replace it with nvram read/write operations diff --git a/src/Makefile b/src/Makefile index 5e8b325..6cd1f6b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -14,9 +14,6 @@ gameloop.o: pacman.h gameloop.h player.h ghosts.h pills.h board.h render.h render.o: pacman.h render.h board.h pills.o: pacman.h pills.h board.h -install: - cat *.c *.h >pactext - clean: -rm -f *.o pacman pactext diff --git a/src/pacman.c b/src/pacman.c index 3c06893..bb748e1 100644 --- a/src/pacman.c +++ b/src/pacman.c @@ -1,5 +1,5 @@ /* -** Pacman - In curses +** Pacman - In curses, for libpayload */ #include #include "pacman.h" @@ -7,39 +7,10 @@ #include "gameloop.h" #include "libpayload.h" -// void GetMarqueeText(GAME_STATE *ptr) { -// FILE *fp = fopen("pactext", "r"); -// int i; -// char *pc; - -// ptr->pMarquee = 0; -// if (fp) { -// fseek(fp, 0, SEEK_END); -// ptr->iMarqueeSize = ftell(fp); -// if ((ptr->pMarquee = malloc(ptr->iMarqueeSize))){ -// fseek(fp,0,SEEK_SET); -// fread(ptr->pMarquee, 1, ptr->iMarqueeSize, fp); -// pc = ptr->pMarquee; -// for(i=0;iiMarqueeSize;i++,pc++) -// if (isalnum(*pc) || ispunct(*pc)) -// ;/*empty*/ -// else -// *pc = ' '; -// } -// fclose(fp); -// } -// } - - - - - - - void GetMarqueeText(GAME_STATE *ptr) { // Hardcoded marquee text (replace this with the actual text if known) - const char *marqueeText = "Pac-Man: Insert Coin to Start! Use Arrow Keys to Move. Eat All Dots to Win!"; + const char *marqueeText = "Pac-Man: Insert Coin to Start! Use X - left; C - right; K - up; M - down to Move. Eat All Dots to Win! "; ptr->iMarqueeSize = strlen(marqueeText); ptr->pMarquee = (char *)malloc(ptr->iMarqueeSize + 1); // Allocate memory for the text plus null terminator @@ -59,16 +30,6 @@ void GetMarqueeText(GAME_STATE *ptr) } } - - - - - - - - - - int main(int argc, char **argv) { GAME_STATE game; void *pRender; diff --git a/src/render.c b/src/render.c index b15e29d..306f323 100644 --- a/src/render.c +++ b/src/render.c @@ -14,6 +14,7 @@ #define PC_EDIBLE_GHOST 6 #define PC_GHOST 20 +// temporary stub to resolve linker problems void fwrite(){ } @@ -229,7 +230,8 @@ char *szAnim = "|Vv_.+*X*+. "; void Pac_RenderGameInfo(void *pCtx) { char *s1 = "ASCII Pacman - Steven Goodwin 2002"; -char *s2 = "Released under the GPL"; +char *s2 = "Ported to libpayload by F.L, 2024"; +char *s3 = "Released under the GPL"; clear(); attron(COLOR_PAIR(PC_PILL)); @@ -238,6 +240,9 @@ char *s2 = "Released under the GPL"; attron(COLOR_PAIR(PC_PACMAN)); mvprintw(3,CenteredX(s2), s2); attroff(COLOR_PAIR(PC_PACMAN)); + attron(COLOR_PAIR(PC_PACMAN)); + mvprintw(4,CenteredX(s3), s3); + attroff(COLOR_PAIR(PC_PACMAN)); } void Pac_RenderRHS(void *pCtx, GAME_STATE *ptr)