[Scummvm-cvs-logs] CVS: residual/lua lundump.cpp,1.3,1.4 lundump.h,1.2,1.3

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Jan 13 10:37:21 CET 2005


Update of /cvsroot/scummvm/residual/lua
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29592/residual/lua

Modified Files:
	lundump.cpp lundump.h 
Log Message:
fixed endian lua code, i misunderstand defs

Index: lundump.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lundump.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- lundump.cpp	12 Jan 2005 22:10:12 -0000	1.3
+++ lundump.cpp	13 Jan 2005 18:36:46 -0000	1.4
@@ -16,8 +16,18 @@
 #define	LoadBlock(b,size,Z)	ezread(Z,b,size)
 #define	LoadNative(t,Z)		LoadBlock(&t,sizeof(t),Z)
 
-#define doLoadNumber(f,Z)	LoadNative(f,Z)
+#define doLoadNumber(f,Z)	f=LoadNumber(Z)
+
 
+static float conv_float(const char *data) {
+        const unsigned char *udata = (const unsigned char *)(data);
+        unsigned char fdata[4];
+        fdata[0] = udata[3];
+        fdata[1] = udata[2];
+        fdata[2] = udata[1];
+        fdata[3] = udata[0];
+        return *(const float *)(fdata);
+}
 
 static void unexpectedEOZ(ZIO* Z)
 {
@@ -51,6 +61,12 @@
  return (hi<<16)|lo;
 }
 
+static float LoadFloat(ZIO* Z)
+{
+ unsigned long l=LoadLong(Z);
+ return conv_float((const char *)&l);
+}
+
 static Byte* LoadCode(ZIO* Z)
 {
  unsigned long size=LoadLong(Z);

Index: lundump.h
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lundump.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- lundump.h	12 Jan 2005 22:10:12 -0000	1.2
+++ lundump.h	13 Jan 2005 18:36:47 -0000	1.3
@@ -49,5 +49,6 @@
 #endif
 
 #define	DumpNumber	DumpFloat
+#define LoadNumber      LoadFloat
 #define SIZEOF_NUMBER	4
 





More information about the Scummvm-git-logs mailing list