image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old April 11th, 2003, 08:53 PM
Registered User
 
Join Date: Apr 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
cypher35 is on a distinguished road
Unhappy Plese help me

i am in the process of porting an app that extracts Xbox *.xpr files so you can edit the texture data of games like Dead or Alive 3...

in the source code, he typedefs "dword" as an unsigned int and includes the dword type in all of his structs for the xpr file structure.

For some odd reason, when i compile it on my mac and run it in the unix terminal, the dwords' Hex values are switched around.

Here's the output in DOS:
XPR0 magic header: 30525058
Filesize: 1677312 (0x199800)
Headersize: 112640 (0x1b800)

Here's the same output in the terminal:
XPR0 magic header: 58505230
Filesize: 9967872 (0x981900)
Headersize: 12058880 (0xb80100)

please help me figure out why... a friend suggested that the intel processer does this "switch" automaticly, but is there a way to change this for compilation on mac?
Reply With Quote
  #2  
Old April 12th, 2003, 10:15 AM
Giaguara's Avatar
Chmod 760
 
Join Date: Nov 2002
Location: ~
Posts: 7,759
Thanks: 2
Thanked 23 Times in 23 Posts
Giaguara is a jewel in the roughGiaguara is a jewel in the roughGiaguara is a jewel in the rough
What are you trying to do exactly?
__________________
MacBook Pro + Mac mini | Newton 2000 | @Work : Dell D620 & 2x20" + a lot of Macs | Workstation, VC & Fusion
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do.
~ Samuel Clemens | Rants | Photos
Reply With Quote
  #3  
Old April 12th, 2003, 12:22 PM
Captain Code's Avatar
Moderator
 
Join Date: Aug 2001
Location: Ontario, Canada
Posts: 3,108
Thanks: 0
Thanked 1 Time in 1 Post
Captain Code will become famous soon enough
I believe DWORD on a PC is defined as an unsigned long. I don't know if that would change the order of the hex values.
__________________
MacBook Pro 2.16GHz Core2Duo 3GB RAM, G4 1.4GHz OSX Tiger 1.25GB RAM, Dual 2GHz G5 OSX Tiger 2GB RAM (freakin shweet)
Athlon 64 Windoze XP for school work (programming) 1GB RAM
dferns@macosx.com
Reply With Quote
  #4  
Old April 12th, 2003, 12:38 PM
Darkshadow's Avatar
wandering shadow
 
Join Date: Jul 2001
Location: DE, USA
Posts: 1,532
Thanks: 0
Thanked 0 Times in 0 Posts
Darkshadow is on a distinguished road
It's the byte-order - Intel machines are little-endian and Macs are big-endian.

You'll need to swap the byte order around for it to work correctly.
__________________
I am but a lonely shadow,
Doomed forever to roam and wander.
But if you allow me to pause before I must go,
I'll spin you tales of mystery and wonder.


Site: Night Productions
Reply With Quote
  #5  
Old April 12th, 2003, 09:00 PM
Registered User
 
Join Date: Apr 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
cypher35 is on a distinguished road
i see, thank you...

i just found a weblink to a little endian/big endian essay...
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 11:33 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.