Anonymous avatar Anonymous committed 83661b9

Ladder bug fixed, was bad shifting in MiClWr16; fixed same bug in MiClWr32

Comments (0)

Files changed (4)

Glitch64/Makefile.clang

 
 CC = /usr/local/bin/clang++
 STRIP = strip
-CFLAGS = -DBUILDING_DLL=1 -fexceptions -fPIC -DPIC -I$(MPAPI_PATH)
+CFLAGS += -DBUILDING_DLL=1 -fexceptions -fPIC -DPIC -I$(MPAPI_PATH)
 
 ifeq ($(OS), Linux)
-LDFLAGS = -shared -lstdc++
+LDFLAGS += -shared -lstdc++
 CFLAGS += -D__unix__
 endif
 ifeq ($(OS), MACOSX)
-LDFLAGS = -dynamiclib -lstdc++ -undefined dynamic_lookup -install_name @executable_path/../lib/glide3x.dylib
+LDFLAGS += -dynamiclib -lstdc++ -undefined dynamic_lookup -install_name @executable_path/../lib/glide3x.dylib
 CFLAGS += -D__unix__ -Dmacintosh
 endif
 ifeq ($(OS), WINDOWS)
-LDFLAGS = -shared -mwindows 
+LDFLAGS += -shared -mwindows 
 CFLAGS += -D__WIN32__ -DWIN32 -D_WIN32
 endif
 

src/Makefile.nowx

 
 AS = nasm
 ASM_OBJ =
-#ifeq ($(OS), Linux)
+#ASM_OBJ = Texture.o
+ifeq ($(OS), Linux)
 ASFLAGS = -O6 -felf -D__linux__ 
 #ASM_OBJ = \
   3dmathSIMD.o \
   FixedPoint.o \
   Texture.o
-#else 
-#  ifeq ($(OS), MACOSX)
+else 
+  ifeq ($(OS), MACOSX)
     ASFLAGS = -O6 -fmacho --prefix _
 #    ASM_OBJ = \
      3dmathSIMD.o \
      FixedPoint.o \
      Texture.o
-#  else 
-#    ifeq ($(OS), WINDOWS)
-#      ASFLAGS = -O6 -fwin32 -D__WIN32__ --prefix _
+  else 
+    ifeq ($(OS), WINDOWS)
+      ASFLAGS = -O6 -fwin32 -D__WIN32__ --prefix _
 #      ASM_OBJ = \
        3dmathSIMD.obj \
        FixedPoint.obj \
        Texture.obj
-#    endif
-#  endif
-#endif
+    endif
+  endif
+endif
 
 RM = rm
 
-/*
-* Glide64 - Glide video plugin for Nintendo 64 emulators.
-* Copyright (c) 2002  Dave2001
-* Copyright (c) 2003-2009  Sergey 'Gonetz' Lipski
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-//****************************************************************
-//
-// Glide64 - Glide Plugin for Nintendo 64 emulators
-// Project started on December 29th, 2001
-//
-// Authors:
-// Dave2001, original author, founded the project in 2001, left it in 2002
-// Gugaman, joined the project in 2002, left it in 2002
-// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
-// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
-//
-//****************************************************************
-//
-// To modify Glide64:
-// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
-// * Do NOT send me the whole project or file that you modified.  Take out your modified code sections, and tell me where to put them.  If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
-//
-//****************************************************************
-
-//****************************************************************
-// 16-bit Horizontal Mirror
-#include <stdint.h>
-#include <string.h>
-typedef uint32_t wxUint32;
-
-void Mirror16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
-{
-    if (mask == 0) return;
-
-    wxUint32 mask_width = (1 << mask);
-    wxUint32 mask_mask = (mask_width-1) << 1;
-    if (mask_width >= max_width) return;
-    int count = max_width - mask_width;
-    if (count <= 0) return;
-    int line_full = real_width;
-    int line = line_full - count;
-    if (line < 0) return;
-    unsigned short * start = (unsigned short *)(tex) + mask_width;
-    
-    unsigned short * edi = start;
-    for(unsigned int ecx = height; ecx; --ecx)
-    {
-        for (int edx = 0; edx != count; ++edx)
-        {
-        unsigned short * esi = (unsigned short *)(tex);
-        if ((mask_width + edx) & mask_width)
-        {
-            esi += (mask_mask - ((edx >> 1) & mask_mask)) / 2;
-        }
-        else
-        {
-            esi += ((edx >> 1) & mask_mask) / 2;
-        }
-        *edi = *esi;
-        ++edi;
-        }
-        edi += line;
-        tex += line_full * 2;
-    }
-}
-
-//****************************************************************
-// 16-bit Horizontal Wrap (like mirror)
-
-void Wrap16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
-{
-    if (mask == 0) return;
-
-    wxUint32 mask_width = (1 << mask);
-
-    wxUint32 mask_mask = (mask_width-1) >> 1;
-
-    if (mask_width >= max_width) return;
-    
-    int count = (max_width - mask_width) >> 1;
-    if (count <= 0) return;
-
-    int line_full = real_width << 1;
-    int line = line_full - (count << 2);
-    if (line < 0) return;
-    unsigned char * start = tex + (mask_width << 1);
-    
-    // values that can't be changed are height and count
-    
-    wxUint32 *edi = (wxUint32 *)start;
-
-    for(wxUint32 ecx = height; ecx; ecx--) {
-      for(wxUint32 edx = 0; edx != count; edx++) {
-        wxUint32 *esi = (wxUint32 *)tex;
-        tex += (edx & mask_mask);
-        *edi = *esi;
-        edi++;
-      }
-      edi += line >> 2;
-      tex += line_full >> 2;
-    }
-    
-}
-
-//****************************************************************
-// 16-bit Horizontal Clamp
-
-void Clamp16bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
-{
-    if (real_width <= width) return;
-
-    unsigned char * dest = tex + (width << 1);
-    unsigned char * constant = dest-2;
-    int count = clamp_to - width;
-
-    int line_full = real_width << 1;
-    int line = width << 1;
-
-// it's ok to manipulate pointers directly, except for tex.
-    
-    wxUint16 *esi = (wxUint16 *)constant;
-    wxUint16 *edi = (wxUint16 *)dest;
-        
-    for (wxUint32 ecx = real_height; ecx; --ecx) {
-      for(wxUint32 edx = count; edx; --edx) {
-        *edi = *esi;
-        edi++;
-      }
-      esi += line_full >> 1;
-      edi += line >> 1;
-    }
-    
-}
-
-//****************************************************************
-// 16-bit Vertical Mirror
-
-void Mirror16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
-{
-    if (mask == 0) return;
-
-    wxUint32 mask_height = (1 << mask);
-    wxUint32 mask_mask = mask_height-1;
-    if (max_height <= mask_height) return;
-    int line_full = real_width << 1;
-
-    unsigned char * dst = tex + mask_height * line_full;
-
-    for (wxUint32 y=mask_height; y<max_height; y++)
-    {
-        if (y & mask_height)
-        {
-            // mirrored
-            memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * line_full), line_full);
-        }
-        else
-        {
-            // not mirrored
-            memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
-        }
-
-        dst += line_full;
-    }
-}
-
-//****************************************************************
-// 16-bit Vertical Wrap
-
-void Wrap16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
-{
-    if (mask == 0) return;
-
-    wxUint32 mask_height = (1 << mask);
-    wxUint32 mask_mask = mask_height-1;
-    if (max_height <= mask_height) return;
-    int line_full = real_width << 1;
-
-    unsigned char * dst = tex + mask_height * line_full;
-
-    for (wxUint32 y=mask_height; y<max_height; y++)
-    {
-        // not mirrored
-        memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
-
-        dst += line_full;
-    }
-}
-
-//****************************************************************
-// 16-bit Vertical Clamp
-
-void Clamp16bT (unsigned char * tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
-{
-    int line_full = real_width << 1;
-    unsigned char * dst = tex + height * line_full;
-    unsigned char * const_line = dst - line_full;
-
-    for (wxUint32 y=height; y<clamp_to; y++)
-    {
-        memcpy ((void*)dst, (void*)const_line, line_full);
-        dst += line_full;
-    }
-}
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002  Dave2001
+* Copyright (c) 2003-2009  Sergey 'Gonetz' Lipski
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified.  Take out your modified code sections, and tell me where to put them.  If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+//****************************************************************
+// 16-bit Horizontal Mirror
+#include <stdint.h>
+#include <string.h>
+typedef uint32_t wxUint32;
+
+void Mirror16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
+{
+    if (mask == 0) return;
+
+    wxUint32 mask_width = (1 << mask);
+    wxUint32 mask_mask = (mask_width-1) << 1;
+    if (mask_width >= max_width) return;
+    int count = max_width - mask_width;
+    if (count <= 0) return;
+    int line_full = real_width;
+    int line = line_full - count;
+    if (line < 0) return;
+    unsigned short * start = (unsigned short *)(tex) + mask_width;
+    
+    unsigned short * edi = start;
+    for(unsigned int ecx = height; ecx; --ecx)
+    {
+        for (int edx = 0; edx != count; ++edx)
+        {
+        unsigned short * esi = (unsigned short *)(tex);
+        if ((mask_width + edx) & mask_width)
+        {
+            esi += (mask_mask - ((edx << 1) & mask_mask)) >> 1;
+        }
+        else
+        {
+            esi += ((edx << 1) & mask_mask) >> 1;
+        }
+        *edi = *esi;
+        ++edi;
+        }
+        edi += line;
+        tex += line_full << 1;
+    }
+}
+
+//****************************************************************
+// 16-bit Horizontal Wrap (like mirror)
+
+void Wrap16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
+{
+    if (mask == 0) return;
+
+    wxUint32 mask_width = (1 << mask);
+
+    wxUint32 mask_mask = (mask_width-1) >> 1;
+
+    if (mask_width >= max_width) return;
+    
+    int count = (max_width - mask_width) >> 1;
+    if (count <= 0) return;
+
+    int line_full = real_width << 1;
+    int line = line_full - (count << 2);
+    if (line < 0) return;
+    unsigned char * start = tex + (mask_width << 1);
+    
+    // values that can't be changed are height and count
+    
+    wxUint32 *edi = (wxUint32 *)start;
+
+    for(wxUint32 ecx = height; ecx; ecx--) {
+      for(wxUint32 edx = 0; edx != count; edx++) {
+        wxUint32 *esi = (wxUint32 *)tex;
+        tex += (edx & mask_mask);
+        *edi = *esi;
+        edi++;
+      }
+      edi += line >> 2;
+      tex += line_full >> 2;
+    }
+    
+}
+
+//****************************************************************
+// 16-bit Horizontal Clamp
+
+void Clamp16bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
+{
+    if (real_width <= width) return;
+
+    unsigned char * dest = tex + (width << 1);
+    unsigned char * constant = dest-2;
+    int count = clamp_to - width;
+
+    int line_full = real_width << 1;
+    int line = width << 1;
+
+// it's ok to manipulate pointers directly, except for tex.
+    
+    wxUint16 *esi = (wxUint16 *)constant;
+    wxUint16 *edi = (wxUint16 *)dest;
+        
+    for (wxUint32 ecx = real_height; ecx; --ecx) {
+      for(wxUint32 edx = count; edx; --edx) {
+        *edi = *esi;
+        edi++;
+      }
+      esi += line_full >> 1;
+      edi += line >> 1;
+    }
+    
+}
+
+//****************************************************************
+// 16-bit Vertical Mirror
+
+void Mirror16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
+{
+    if (mask == 0) return;
+
+    wxUint32 mask_height = (1 << mask);
+    wxUint32 mask_mask = mask_height-1;
+    if (max_height <= mask_height) return;
+    int line_full = real_width << 1;
+
+    unsigned char * dst = tex + mask_height * line_full;
+
+    for (wxUint32 y=mask_height; y<max_height; y++)
+    {
+        if (y & mask_height)
+        {
+            // mirrored
+            memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * line_full), line_full);
+        }
+        else
+        {
+            // not mirrored
+            memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
+        }
+
+        dst += line_full;
+    }
+}
+
+//****************************************************************
+// 16-bit Vertical Wrap
+
+void Wrap16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
+{
+    if (mask == 0) return;
+
+    wxUint32 mask_height = (1 << mask);
+    wxUint32 mask_mask = mask_height-1;
+    if (max_height <= mask_height) return;
+    int line_full = real_width << 1;
+
+    unsigned char * dst = tex + mask_height * line_full;
+
+    for (wxUint32 y=mask_height; y<max_height; y++)
+    {
+        // not mirrored
+        memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
+
+        dst += line_full;
+    }
+}
+
+//****************************************************************
+// 16-bit Vertical Clamp
+
+void Clamp16bT (unsigned char * tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
+{
+    int line_full = real_width << 1;
+    unsigned char * dst = tex + height * line_full;
+    unsigned char * const_line = dst - line_full;
+
+    for (wxUint32 y=height; y<clamp_to; y++)
+    {
+        memcpy ((void*)dst, (void*)const_line, line_full);
+        dst += line_full;
+    }
+}
 	if (mask_width >= max_width) return;
 	int count = max_width - mask_width;
 	if (count <= 0) return;
-  int line_full = real_width << 2;
-  int line = line_full - (count << 2);
+  int line_full = real_width; // << 2;
+  int line = line_full - (count); // << 2);
 	if (line < 0) return;
 	
-	wxUint32 *start = (wxUint32 *)tex + (mask_width);
+  unsigned int * start = (unsigned int *)(tex) + (mask_width); // << 2);
 	
-  wxUint32 *edi = start;
+  // asmMirror32bS (tex, start, mask_width, height, mask_mask, line, line_full, count);
+
+	// ARGS in asm:   tex, start,      width, height, mask     , line,      full, count
+	
+  unsigned int *edi = start;
   
-  for(wxUint32 ecx = height; ecx; --ecx) {
-    for(wxUint32 edx = 0; edx != count; edx++) {
+  for(unsigned int ecx = height; ecx; --ecx) {
+    for(int edx = 0; edx != count; ++edx) {
       
-      wxUint32 *esi = (wxUint32 *)tex;
-      wxUint32 ebx = mask_width;
-      ebx += edx;
+      unsigned int *esi = (unsigned int *)(tex);
+      
       if ((mask_width + edx) & mask_width) {
         esi += (mask_mask - ((edx << 2) & mask_mask)) >> 2;
       }
       else
+      {
         esi += ((edx << 2) & mask_mask) >> 2;
-        
+      } 
       *edi = *esi;
       edi++;
     }
-    edi += line >> 2;
-    tex += line_full;
+    edi += line;
+    tex += line_full << 2;
   }
 }
 
   if (mask == 0) return;
 
   wxUint32 mask_width = (1 << mask);
-  wxUint32 mask_mask = (mask_width-1);
+  wxUint32 mask_mask = (mask_width-1) >> 2;
   if (mask_width >= max_width) return;
   int count = (max_width - mask_width);
   if (count <= 0) return;
 	wxUint32 mask_height = (1 << mask);
 	wxUint32 mask_mask = mask_height-1;
 	if (max_height <= mask_height) return;
-  int line_full = real_width; //<< 2;
+  int line_full = real_width << 2;
 
-	wxUint32 *dst = (wxUint32 *)tex + mask_height * line_full;
+	wxUint32 *dst = (wxUint32 *)tex + ((mask_height * line_full) >> 2);
 
 	for (wxUint32 y=mask_height; y<max_height; y++)
 	{
 		if (y & mask_height)
 		{
 			// mirrored
-			memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * (line_full>>2)), line_full>>2);
+			memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * line_full), line_full);
 		}
 		else
 		{
 			// not mirrored
-			memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * (line_full>>2)), line_full>>2);
+			memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
 		}
 
 		dst += line_full>>2;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.