Merge pull request #542 from gameblabla/mdec_fix
[pcsx_rearmed.git] / plugins / gpu_neon / psx_gpu / psx_gpu_parse.c
index a364eef..87d8c38 100644 (file)
@@ -435,7 +435,10 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command)
           num_vertexes++;
 
           if(list_position >= list_end)
-            break;
+          {
+            current_command = (u32)-1;
+            goto breakloop;
+          }
 
           xy = *list_position;
           if((xy & 0xF000F000) == 0x50005000)
@@ -496,7 +499,10 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command)
           num_vertexes++;
 
           if(list_position >= list_end)
-            break;
+          {
+            current_command = (u32)-1;
+            goto breakloop;
+          }
 
           color = list_position[0];
           if((color & 0xF000F000) == 0x50005000)
@@ -774,9 +780,7 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command)
        }
   }
 
-#ifdef PCSX
 breakloop:
-#endif
   if (last_command != NULL)
     *last_command = current_command;
   return list - list_start;
@@ -864,7 +868,72 @@ extern void scale2x_tiles8(void *dst, const void *src, int w8, int h);
 
 #ifndef NEON_BUILD
 // TODO?
-void scale2x_tiles8(void *dst, const void *src, int w8, int h) {}
+void scale2x_tiles8(void *dst, const void *src, int w8, int h)
+{
+  uint16_t* d = (uint16_t*)dst;
+  const uint16_t* s = (const uint16_t*)src;
+
+  while ( h-- )
+  {
+    uint16_t* d_save = d;
+    const uint16_t* s_save = s;
+    int w = w8;
+
+    while ( w-- )
+    {
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+
+      d[    0 ] = *s;
+      d[    1 ] = *s;
+      d[ 1024 ] = *s;
+      d[ 1025 ] = *s;
+      d += 2; s++;
+    }
+
+    d = d_save + 2048;
+    s = s_save + 1024; /* or 512? */
+  }
+}
 #endif
 
 static int disable_main_render;
@@ -1193,7 +1262,10 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size,
           num_vertexes++;
 
           if(list_position >= list_end)
-            break;
+          {
+            current_command = (u32)-1;
+            goto breakloop;
+          }
 
           xy = *list_position;
           if((xy & 0xF000F000) == 0x50005000)
@@ -1259,7 +1331,10 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size,
           num_vertexes++;
 
           if(list_position >= list_end)
-            break;
+          {
+            current_command = (u32)-1;
+            goto breakloop;
+          }
 
           color = list_position[0];
           if((color & 0xF000F000) == 0x50005000)