I need someone to check if my program works on big-endian (Mac)

Started by
16 comments, last by silverphyre673 18 years, 10 months ago
Quote:Original post by Anonymous Poster
the endian won't and doesn't matter


Unless you transfer the file to another comp, with another endianess.. I think anyway.. :p
Advertisement
Endian-ness matters the most when networking. And there are functions to convert to network byteorder and host byteorder. So it shouldn't be a problem.
Ok I got it built on a G3 running at 233mhz (yeah, it's an old computer) on OS 10.2.8


Output of first run through the program:
ERROR: Load Failed!
1: Jack has 32 points.

Output 2:
1: Jack has 32 points.
2: Jane has 18 points

3rd time running it:
1: Jack has 32 points.
2: Jane has 18 points.
3: Jerry has 3 points.

4th time:
1: Jack has 32 points.
2: Jane has 18 points.
3: Jerry has 3 points.
4: Jerry has 3 points.

5th time:
1: Bobby has 39 points.
2: Jack has 32 points.
3: Jane has 18 points.
4: Jerry has 3 points.
5: Jerry has 3 points.


Wish I could help fix it, but my knowledge of getting endian stuff to work is a bit lacking.

Have you ever considered using a text file? It would mean not having to worry about the endian issue here. If you wanted you could compress the high scores or make up an encryption algorithm (it's not like you're protecting credit card numbers here, so if was broken it wouldn't matter) to make it a little harder for user to cheat.
Forgot to mention I got these warnings compiling it:
hiscoresystem.cpp: In member function `bool HiscoreSystem::Load()':
hiscoresystem.cpp:156: warning: comparison between signed and unsigned integer
expressions

endianfunctions.cpp: In function `char* ReverseByteOrder(const char*)':
endianfunctions.cpp:11: warning: unused variable `char swap'


Also just tested in on a x86 linux box and got pretty much the same result


Also, to make it easier for someone else to test it OS X or linux here's a Makefile:
all: hiscorehiscore: main.o hiscore.o hiscoresystem.o endianfunctions.o	g++ -Wall -o hiscore main.o hiscore.o hiscoresystem.o endianfunctions.omain.o: main.cpp	g++ -Wall -c main.cpphiscore.o: hiscore.cpp hiscore.h	g++ -Wall -c hiscore.cpphiscoresystem.o: hiscoresystem.cpp hiscoresystem.h	g++ -Wall -c hiscoresystem.cppendianfunctions.o:	g++ -Wall -c endianfunctions.cppclean:	rm *.o hiscore


just remember to name the file Makefile
put it in the same directory as the code
go to the directory in the terminal
type make

Well... I guess nobody is going to be transferring their hiscore file from a max to their PC :)

I think I'll just take it out. Thanks for your help, everyone!
my siteGenius is 1% inspiration and 99% perspiration
Quote:Original post by silverphyre673
Well... I guess nobody is going to be transferring their hiscore file from a max to their PC :)

I think I'll just take it out. Thanks for your help, everyone!


I got the same problems on an x86 box running linux (so it's probably not an endian thing). I haven't had the time to look through your source yet.

I compiled your code with g++, is there a chance that in your code you're doing something that in standard c++ is undefined, which works with the microsoft compilers, but since it is undefined behaves differently in the GNU compilers?

I'll take a look around when I get the chance. Also, you might want to ask the same question in the forums at www.idevgames.com. There are many more mac game developers there than here.
I just tried it on a PowerBook G4 (1.6 GHz) with MacOSX 10.4.1. Anyway, it really doesn't work so well. Same issues as Will F...but I am sure you could have guessed that.
I'm using dev-cpp with mingw. I just took out the endian stuff, but haven't reloaded it. At some point tonight (when I'm done studying for finals tomorrow) I will try it on my linux box w/ g++. Thanks for all your help!
my siteGenius is 1% inspiration and 99% perspiration

This topic is closed to new replies.

Advertisement