Browse Source

renderer bugfix, minor adjustments

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@395 be3aeb3a-fb24-0410-a615-afba39da0efa
notaz 16 years ago
parent
commit
7b802576b2
6 changed files with 21 additions and 12 deletions
  1. 2 0
      Pico/Draw.c
  2. 7 7
      Pico/Draw.s
  3. 0 3
      Pico/Pico.h
  4. 9 1
      platform/common/config.c
  5. 2 0
      platform/common/emu.c
  6. 1 1
      platform/gp2x/emu.c

+ 2 - 0
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
 
 

+ 7 - 7
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]

+ 0 - 3
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

+ 9 - 1
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);

+ 2 - 0
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)

+ 1 - 1
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