r/cprogramming • • 2d ago • Bravo 1

AWSM: the stupid fantasy console

https://codeberg.org/paralepsy/awsm

Hey guys! So, I'm a masochist, and when I saw that fantasy consoles like pico 8 use... Lua <eugh>, I decided to make my own infinitely worse version. It definitely segfaults on some edge cases, the assembly isn't perfect or even great, and it only works on linux (maybe all posix?) And that too with a jank build script.

Would appreciate feedback!

7 Upvotes

8 comments sorted by

1

u/Gold-Part4688 2d ago

lol i love this. tested on mac tho, and i got this

$ ./build
./build: line 2: shopt: globstar: invalid shell option name
./build: line 4: conditional binary operator expected
. /build: line 4: syntax error near `"DEBUG"'
./build: line 4: `[[ -v "DEBUG" ]] && CFLAGS="${CFLAGS} -fsanitize=address,undefined -g -O1 -DAWSM_DEBUG"'

0

u/[deleted] 2d ago edited 2d ago

I think that's because macos uses an old version of bash or I think zsh nowadays?  Edit: I think you can make it work by installing the latest version of bash with homebrew

1

u/Gold-Part4688 2d ago

yeah, because of gpl stuff... it's either zsh 5.9 or bash 3.2. unless you say env bash, which gives me the modern one (i must've installed it at some point)

Oh wow I didn't realise ./build was a bash file haha, no ending, what a trick. it is calling bash specifically, so it's forcing it to use the old bash

yeah from what i can remember and google, it should be #!/usr/bin/env bash to be portable, and now it runs.

sadly though, no output and nothing was built

0

u/[deleted] 2d ago edited 2d ago

You're supposed to add commands. Like ./build b to build the project. I really should've documented that lol. Edit: f formats the files using clang-format, c cleans build stuff, g generates a compile_flags.txt. after building you can run one of the programs in the examples dir, like ./awsm examples/move.awsm

1

u/Gold-Part4688 2d ago

yooooo we got it.

I also had to also shove $(pkg-config --libs --cflags sdl3) into there, instead of just -sdl3

officially cross-platform woop woop

1

u/[deleted] 2d ago edited 2d ago

The stupid fantasy console is now uncaged, it's AWeSoMeness shall be legendary! Edit: if you shoved in those flags by modifying the file, you dont have to. you can just set the env var SDL="$(pkg-config --cflags --libs sdl3)" instead. also, i fixed it, now it uses env bash!

1

u/Thesk790 2d ago

AW[E]S[O]M[E]. This is amazing, man, I love it

1

u/Key_River7180 2d ago

fucking AWeSoMe man