[Scummvm-cvs-logs] CVS: tools descumm3.cpp,1.1,1.2

Mutwin Kraus mutle at users.sourceforge.net
Mon Mar 18 11:01:40 CET 2002


Update of /cvsroot/scummvm/tools
In directory usw-pr-cvs1:/tmp/cvs-serv23911/tools

Modified Files:
	descumm3.cpp 
Log Message:
Added big Endian compatibility, just need to define SCUMM_BIG_ENDIAN while compiling

Index: descumm3.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm3.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** descumm3.cpp	16 Mar 2002 08:01:54 -0000	1.1
--- descumm3.cpp	18 Mar 2002 19:00:41 -0000	1.2
***************
*** 23,29 ****
  #include <stdio.h>
  
! #ifdef UNIX
  #include <ctype.h>
! #endif
  
  #ifdef WIN32
--- 23,29 ----
  #include <stdio.h>
  
! //#ifdef UNIX
  #include <ctype.h>
! //#endif
  
  #ifdef WIN32
***************
*** 111,114 ****
--- 111,125 ----
  bool emit_if(char *before, char *after);
  
+ #if defined(SCUMM_BIG_ENDIAN)
+ 
+ unsigned long inline TO_LE_32(unsigned long a) {
+ 	return ((a>>24)&0xFF) + ((a>>8)&0xFF00) + ((a<<8)&0xFF0000) + ((a<<24)&0xFF000000);
+ }
+ 
+ unsigned short inline TO_LE_16(unsigned short a) {
+ 	return ((a>>8)&0xFF) + ((a<<8)&0xFF00);
+ }
+ 
+ #endif
   
  int get_byte() {
***************
*** 117,121 ****
--- 128,136 ----
  
  int get_word() {
+ #if defined(SCUMM_BIG_ENDIAN)
+   int i = TO_LE_16(*((short*)cur_pos));
+ #else
    int i = *((short*)cur_pos);
+ #endif
    cur_pos+=2;
    return i;
***************
*** 1518,1523 ****
  	
  	buf = (char*)malloc(4096);
! 	
  	switch( *((long*)mem + 1) & 0xFFFF) {
  	case MKID('LS'): 
  		printf("Script# %d\n", (unsigned char)mem[8]);
--- 1533,1541 ----
  	
  	buf = (char*)malloc(4096);
! 	#if defined(SCUMM_BIG_ENDIAN)
! 	switch( TO_LE_16(*((long*)mem + 1) & 0xFFFF)) {
! 	#else
  	switch( *((long*)mem + 1) & 0xFFFF) {
+ 	#endif
  	case MKID('LS'): 
  		printf("Script# %d\n", (unsigned char)mem[8]);





More information about the Scummvm-git-logs mailing list