diff options
author | aiju <devnull@localhost> | 2014-02-23 11:55:29 +0100 |
---|---|---|
committer | aiju <devnull@localhost> | 2014-02-23 11:55:29 +0100 |
commit | 662fff51f01f1886d52ece8ae55d6d6d422d5a52 (patch) | |
tree | 5432b31a7de9a2032e3d844733b1abef50f6a40a /sys/src | |
parent | 0201795805f22e3d8d0b347d06c39d934c8b6866 (diff) |
games/nes: added oflag
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/games/nes/dat.h | 2 | ||||
-rw-r--r-- | sys/src/games/nes/nes.c | 13 | ||||
-rw-r--r-- | sys/src/games/nes/ppu.c | 10 |
3 files changed, 17 insertions, 8 deletions
diff --git a/sys/src/games/nes/dat.h b/sys/src/games/nes/dat.h index 0dee8f83b..04e2c5042 100644 --- a/sys/src/games/nes/dat.h +++ b/sys/src/games/nes/dat.h @@ -6,7 +6,7 @@ extern u16int pput, ppuv; extern u8int ppusx, vrambuf; extern int mirr, ppux, ppuy, odd, vramlatch, keylatch; -extern int map, scale, mmc3hack; +extern int map, scale, mmc3hack, oflag; extern uchar *prg, *chr; extern int nprg, nchr, map, chrram; diff --git a/sys/src/games/nes/nes.c b/sys/src/games/nes/nes.c index 6c9c8c69d..15bee498f 100644 --- a/sys/src/games/nes/nes.c +++ b/sys/src/games/nes/nes.c @@ -15,7 +15,7 @@ Rectangle picr; Image *tmp, *bg; int clock, ppuclock, syncclock, syncfreq, checkclock, msgclock, sleeps; Mousectl *mc; -int keys, paused, savereq, loadreq; +int keys, paused, savereq, loadreq, oflag; int mirr; QLock pauselock; @@ -155,11 +155,12 @@ keyproc(void *) void threadmain(int argc, char **argv) { - int t; + int t, h; Point p; uvlong old, new, diff; scale = 1; + h = 240; ARGBEGIN { case '2': scale = 2; @@ -167,6 +168,10 @@ threadmain(int argc, char **argv) case '3': scale = 3; break; + case 'o': + oflag = 1; + h -= 16; + break; } ARGEND; if(argc < 1) @@ -180,9 +185,9 @@ threadmain(int argc, char **argv) proccreate(keyproc, nil, 8192); originwindow(screen, Pt(0, 0), screen->r.min); p = divpt(addpt(screen->r.min, screen->r.max), 2); - picr = (Rectangle){subpt(p, Pt(scale * 128, scale * 120)), addpt(p, Pt(scale * 128, scale * 120))}; + picr = (Rectangle){subpt(p, Pt(scale * 128, scale * h/2)), addpt(p, Pt(scale * 128, scale * h/2))}; if(screen->chan != XRGB32) - tmp = allocimage(display, Rect(0, 0, scale * 256, scale * 240), XRGB32, 0, 0); + tmp = allocimage(display, Rect(0, 0, scale * 256, scale * h), XRGB32, 0, 0); bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF); draw(screen, screen->r, bg, nil, ZP); diff --git a/sys/src/games/nes/ppu.c b/sys/src/games/nes/ppu.c index 09b875851..14926a2cf 100644 --- a/sys/src/games/nes/ppu.c +++ b/sys/src/games/nes/ppu.c @@ -257,22 +257,26 @@ flush(void) extern Mousectl *mc; Mouse m; Point p; + int h; + h = 240; + if(oflag) + h -= 16; while(nbrecv(mc->c, &m) > 0) ; if(nbrecvul(mc->resizec) > 0){ if(getwindow(display, Refnone) < 0) sysfatal("resize failed: %r"); p = divpt(addpt(screen->r.min, screen->r.max), 2); - picr = (Rectangle){subpt(p, Pt(scale * 128, scale * 120)), addpt(p, Pt(scale * 128, scale * 120))}; + picr = (Rectangle){subpt(p, Pt(scale * 128, scale * h/2)), addpt(p, Pt(scale * 128, scale * h/2))}; bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF); draw(screen, screen->r, bg, nil, ZP); } if(tmp){ - loadimage(tmp, tmp->r, pic, 256*240*4*scale*scale); + loadimage(tmp, tmp->r, pic + oflag*8*256*4*scale*scale, 256*h*4*scale*scale); draw(screen, picr, tmp, nil, ZP); }else - loadimage(screen, picr, pic, 256*240*4*scale*scale); + loadimage(screen, picr, pic + oflag*8*256*4*scale*scale, 256*h*4*scale*scale); flushimage(display, 1); memset(pic, sizeof pic, 0); } |