From 7b802576b284e113c637324e583a3a44e0e8e871 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 25 Mar 2008 22:37:37 +0000 Subject: [PATCH] renderer bugfix, minor adjustments git-svn-id: file:///home/notaz/opt/svn/PicoDrive@395 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Draw.c | 2 ++ Pico/Draw.s | 14 +++++++------- Pico/Pico.h | 3 --- platform/common/config.c | 10 +++++++++- platform/common/emu.c | 2 ++ platform/gp2x/emu.c | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Pico/Draw.c b/Pico/Draw.c index 6f60a03..4901938 100644 --- a/Pico/Draw.c +++ b/Pico/Draw.c @@ -54,6 +54,7 @@ void DrawSpritesFromCache(int *hc, int sh); void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells); void FinalizeLineBGR444(int sh); void FinalizeLineRGB555(int sh); +void *blockcpy(void *dst, const void *src, size_t n); void blockcpy_or(void *dst, void *src, size_t n, int pat); #else // utility @@ -63,6 +64,7 @@ void blockcpy_or(void *dst, void *src, size_t n, int pat) for (; n; n--) *pd++ = (unsigned char) (*ps++ | pat); } +#define blockcpy memcpy #endif diff --git a/Pico/Draw.s b/Pico/Draw.s index 3a3da81..5ddd5e6 100644 --- a/Pico/Draw.s +++ b/Pico/Draw.s @@ -444,8 +444,8 @@ DrawLayer: .DrawStrip_vsscroll: rsb r8, r3, #0 mov r8, r8, lsr #3 @ r8=tilex=(-ts->hscroll)>>3 - bic r8, r8, #0xff000000 - orr r8, r8, r5, lsl #25 @ r8=(xmask[31:25]|had_output[24]|tilex[23:0]) + bic r8, r8, #0x3fc00000 + orr r8, r8, r5, lsl #25 @ r8=(xmask[31:25]|had_output[24]|tilex[21:0]) ldr r4, =Scanline orr r5, r1, r10, lsl #24 @@ -504,9 +504,9 @@ DrawLayer: ldrh r7, [r7] @ r7=vscroll bic r10,r10,#0xff @ clear old ty - and r4, r5, #0xff0000 - add r4, r4, r7, lsl #16 - and r4, r4, r5, lsl #16 @ r4=line<<16 + and r4, r5, #0xff0000 @ scanline + add r4, r4, r7, lsl #16 @ ... += vscroll + and r4, r4, r5, lsl #16 @ ... &= ymask and r7, r4, #0x70000 orr r10,r10,r7, lsr #15 @ new ty @@ -529,7 +529,7 @@ DrawLayer: beq .DrawStrip_vs_samecode @ we know stuff about this tile already mov r9, r7 @ remember code - orr r8, r8, #1<<24 @ seen non hi-prio tile + orr r8, r8, #(1<<24)@ seen non hi-prio tile movs r2, r9, lsl #20 @ if (code&0x1000) mov r2, r2, lsl #1 @@ -603,7 +603,7 @@ DrawLayer: b .dsloop_vs .dsloop_vs_exit: - tst r8, #1<<24 @ seen non hi-prio tile + tst r8, #(1<<24) @ seen non hi-prio tile ldreq r1, =rendstatus mov r0, #0 ldreq r2, [r1] diff --git a/Pico/Pico.h b/Pico/Pico.h index 52ea63e..9dae8df 100644 --- a/Pico/Pico.h +++ b/Pico/Pico.h @@ -119,10 +119,7 @@ extern unsigned short HighPal[0x100]; extern int rendstatus; // utility #ifdef _ASM_DRAW_C -void *blockcpy(void *dst, const void *src, size_t n); void vidConvCpyRGB565(void *to, void *from, int pixels); -#else -#define blockcpy memcpy #endif // Draw2.c diff --git a/platform/common/config.c b/platform/common/config.c index c117fb9..a1808ee 100644 --- a/platform/common/config.c +++ b/platform/common/config.c @@ -21,7 +21,7 @@ extern const int cdopt_entry_count; static menu_entry *cfg_opts[] = { opt_entries, opt2_entries, cdopt_entries }; static const int *cfg_opt_counts[] = { &opt_entry_count, &opt2_entry_count, &cdopt_entry_count }; -#define NL "\n" +#define NL "\r\n" static char *mystrip(char *str) @@ -322,6 +322,9 @@ write: keys_write(fn, "bind_joy2", currentConfig.JoyBinds[2], defaultConfig.JoyBinds[2], joyKeyNames, 1); keys_write(fn, "bind_joy3", currentConfig.JoyBinds[3], defaultConfig.JoyBinds[3], joyKeyNames, 1); + if (section == NULL) + fprintf(fn, "Sound Volume = %i" NL, currentConfig.volume); + fprintf(fn, NL); if (fo != NULL) @@ -626,6 +629,11 @@ static void parse(const char *var, const char *val) if (strcasecmp(var, "LastUsedROM") == 0) return; /* handled elsewhere */ + if (strcasecmp(var, "Sound Volume") == 0) { + currentConfig.volume = atoi(val); + return; + } + // key binds if (strncasecmp(var, "bind ", 5) == 0) { keys_parse(var + 5, val, currentConfig.KeyBinds, keyNames); diff --git a/platform/common/emu.c b/platform/common/emu.c index 02640bb..ab17a1f 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -511,8 +511,10 @@ int emu_ReadConfig(int game, int no_defaults) ret = -1; if (config_havesect(cfg, sect)) { + int vol = currentConfig.volume; emu_setDefaultConfig(); ret = config_readsect(cfg, sect); + currentConfig.volume = vol; // make vol global (bah) } if (ret != 0) diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 0375a7f..f251188 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -272,7 +272,7 @@ static void blit(const char *fps, const char *notice) vidConvCpyRGB32(localPal, Pico.cram, 0x40); vidConvCpyRGB32sh(localPal+0x40, Pico.cram, 0x40); vidConvCpyRGB32hi(localPal+0x80, Pico.cram, 0x40); - blockcpy(localPal+0xc0, localPal+0x40, 0x40*4); + memcpy32(localPal+0xc0, localPal+0x40, 0x40); localPal[0xc0] = 0x0000c000; localPal[0xd0] = 0x00c00000; localPal[0xe0] = 0x00000000; // reserved pixels for OSD -- 2.39.2