uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 2c78f2cedf612db3daf119e7551c0e65449625ef
parent b46d317b4f767a9c1b66d56dac73ba8f1ba7dac4
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 28 Jul 2021 20:20:57 -0700

Named System device

Diffstat:
Msrc/uxncli.c | 4++--
Msrc/uxnemu.c | 10+++++-----
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/uxncli.c b/src/uxncli.c @@ -17,7 +17,7 @@ WITH REGARD TO THIS SOFTWARE. #pragma mark - Core -static Device *devconsole; +static Device *devsystem, *devconsole; static int error(char *msg, const char *err) @@ -133,7 +133,7 @@ main(int argc, char **argv) if(!loaduxn(&u, argv[1])) return error("Load", "Failed"); - portuxn(&u, 0x0, "system", system_talk); + devsystem = portuxn(&u, 0x0, "system", system_talk); devconsole = portuxn(&u, 0x1, "console", console_talk); portuxn(&u, 0x2, "empty", nil_talk); portuxn(&u, 0x3, "empty", nil_talk); diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -28,7 +28,7 @@ static SDL_Texture *fgTexture, *bgTexture; static SDL_Rect gRect; static Ppu ppu; static Apu apu[POLYPHONY]; -static Device *devscreen, *devmouse, *devctrl, *devaudio0, *devconsole; +static Device *devsystem, *devscreen, *devmouse, *devctrl, *devaudio0, *devconsole; static Uint32 stdin_event; #define PAD 4 @@ -64,7 +64,7 @@ audio_callback(void *u, Uint8 *stream, int len) static void redraw(Uxn *u) { - if(u->dev[0].dat[0xe]) + if(devsystem->dat[0xe]) inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat); SDL_UpdateTexture(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32)); SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.pixels, ppu.width * sizeof(Uint32)); @@ -78,7 +78,7 @@ redraw(Uxn *u) static void toggledebug(Uxn *u) { - u->dev[0].dat[0xe] = !u->dev[0].dat[0xe]; + devsystem->dat[0xe] = !devsystem->dat[0xe]; redraw(u); } @@ -390,7 +390,7 @@ run(Uxn *u) } } evaluxn(u, mempeek16(devscreen->dat, 0)); - if(reqdraw || u->dev[0].dat[0xe]) + if(reqdraw || devsystem->dat[0xe]) redraw(u); if(!bench) { elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f; @@ -417,7 +417,7 @@ main(int argc, char **argv) if(!init()) return error("Init", "Failed to initialize emulator."); - portuxn(&u, 0x0, "system", system_talk); + devsystem = portuxn(&u, 0x0, "system", system_talk); devconsole = portuxn(&u, 0x1, "console", console_talk); devscreen = portuxn(&u, 0x2, "screen", screen_talk); devaudio0 = portuxn(&u, 0x3, "audio0", audio_talk);