X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fgp2x%2Fminimal.c;h=e11643e86e126919601cee85674996f8377ab0cf;hb=6f6bc6fa47b2888c4420eeb323d96be0982150de;hp=ba4ffe0e3340742d9bf2182db1d490fb61e98640;hpb=b2b95d2e0d1fd5e52d03c2152605b09b024c1d0e;p=fceu.git diff --git a/drivers/gp2x/minimal.c b/drivers/gp2x/minimal.c index ba4ffe0..e11643e 100644 --- a/drivers/gp2x/minimal.c +++ b/drivers/gp2x/minimal.c @@ -40,6 +40,7 @@ volatile unsigned short *gp2x_memregs; volatile unsigned long *gp2x_memregl; static void *gp2x_screens[4]; static int screensel = 0; +static int gp2x_screen_offs = 0; //static int memdev = 0; static int sounddev = 0, mixerdev = 0; @@ -57,20 +58,18 @@ static int gp2x_screenaddrs_use[4]; static unsigned short gp2x_screenaddr_old[4]; -// hack to simplify thing for fceu -static int scaling_enabled = 0; - /* video stuff */ void gp2x_video_flip(void) { unsigned short lsw, msw; int addr = gp2x_screenaddrs_use[screensel&3]; - if (scaling_enabled) addr += 32; + addr += gp2x_screen_offs; // since we are using the mmu hack, we must flush the cache first // (the params are most likely wrong, but they seem to work somehow) - flushcache(addr, addr + 320*240*2, 0); + //flushcache(addr, addr + 320*240*2, 0); + flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0); lsw = (unsigned short) addr; msw = (unsigned short)(addr >> 16); @@ -133,9 +132,6 @@ void gp2x_video_RGB_setscaling(int ln_offs, int W, int H) int bpp = (gp2x_memregs[0x28DA>>1]>>9)&0x3; unsigned short scalw; - // fceu hack - scaling_enabled = (W == 320) ? 0 : 1; - // set offset gp2x_screenaddrs_use[0] = gp2x_screenaddrs[0] + ln_offs * 320 * bpp; gp2x_screenaddrs_use[1] = gp2x_screenaddrs[1] + ln_offs * 320 * bpp; @@ -163,6 +159,10 @@ void gp2x_video_RGB_setscaling(int ln_offs, int W, int H) gp2x_memregl[0x2908>>2]=(unsigned long)((float)escalah *bpp *(H/240.0)); } +void gp2x_video_set_offs(int offs) +{ + gp2x_screen_offs = offs; +} void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len) { @@ -220,7 +220,10 @@ void gp2x_start_sound(int rate, int bits, int stereo) if (sounddev > 0) close(sounddev); sounddev = open("/dev/dsp", O_WRONLY|O_ASYNC); if (sounddev == -1) + { printf("open(\"/dev/dsp\") failed with %i\n", errno); + return; + } ioctl(sounddev, SNDCTL_DSP_SPEED, &rate); ioctl(sounddev, SNDCTL_DSP_SETFMT, &bits);