The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 07, 2024, 07:03:28 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  UQM on Gentoo linux amd64
« previous next »
Pages: [1] 2 Print
Author Topic: UQM on Gentoo linux amd64  (Read 5542 times)
azathoth
Guest


Email
UQM on Gentoo linux amd64
« on: July 27, 2005, 04:50:07 am »

After a small search on these forums I saw someone mentioning that the game wont run on an amd64 system, but the post wasn't that recent ...

My question is this  : I emerged the game using accept_keywords on gentoo, and everything compiled just fine .. no problems whatsoever.
However, the game will pop up a window for a fraction of a second, report 'Killed' after loading 'lbm/title.ani', and, well, die. I'm pretty sure all the content files are in the right locations, and there seem to be no errors reported before that last 'Killed' line : everything is initialized successfully .. 

Is this what's supposed to happen on an amd64 system?
Thanks in advance =)
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: UQM on Gentoo linux amd64
« Reply #1 on: July 27, 2005, 09:40:17 pm »

The current code is not 64 bits clean. It will compile, but the executable will crash. But if the system that you're compiling on can use 32 bits executables (which I suspect yours can), you should be able to run UQM if it's compiled in 32 bits mode. Putting '-m32' in the environment variable CFLAGS should take care of that. (Be sure to rerun './build.sh configure' if you have already configered the build process).
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
azathoth
Guest


Email
Re: UQM on Gentoo linux amd64
« Reply #2 on: July 28, 2005, 10:16:05 pm »

Thanks , I'm going to try that =)
Logged
nate
Guest


Email
Re: UQM on Gentoo linux amd64
« Reply #3 on: October 19, 2005, 02:49:00 am »

hey i was wondering if you might provide a sample of the kinds of things you have to alter in order to get uqm to run on a 64bit machine.  im using gentoo too and have studied c++ for a couple of years so for my personal enjoyment of looking through c code (not being sarcastic here Smiley I was wondering if you might post an example.  I would appreciate it.

Thanks for your time.
Logged
Nate
Guest


Email
Re: UQM on Gentoo linux amd64
« Reply #4 on: October 19, 2005, 03:09:06 am »

I was looking at some of the macros defined in compiler.h and I have to admit that I have never seen anything like them.

I was lucky enough to find explanations for them here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pluslang_expressions_with_binary_operators.asp

Bitwise Inclusive OR Operator: |
Right shift (>>)
Left shift (<<)

Anyway, what exactly are you building with those macros?
Logged
Nate
Guest


Email
Re: UQM on Gentoo linux amd64
« Reply #5 on: October 19, 2005, 03:15:50 am »

And whats going on here:

typedef  void     (*PVOIDFUNC) (void);

is this similar to casting?
Logged
Novus
Enlightened
*****
Offline Offline

Gender: Male
Posts: 1938


Fot or not?


View Profile
Re: UQM on Gentoo linux amd64
« Reply #6 on: October 19, 2005, 09:51:33 am »

Anyway, what exactly are you building with those macros?
Those are macros to extract parts of bytes, words and double words and combine them. UQM has a lot of hand-optimised bitfield values where a single byte, word (16 bits) or double word (32 bits) contains a lot of smaller values.

If bit manipulation of this sort confuses you, you will have problems trying to make UQM 64-bit clean.

And whats going on here:

typedef void (*PVOIDFUNC) (void);

is this similar to casting?
No. It's a definition of a new type PVOIDFUNC as a pointer to a function of the form void function(void). Again, if type declarations confuse you, you will have a lot of trouble.
Logged

RTFM = Read the fine manual.
RTTFAQ = Read the Ur-Quan Masters Technical FAQ.
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: UQM on Gentoo linux amd64
« Reply #7 on: October 19, 2005, 11:03:48 am »

There are a couple of assumptions that are made in the code that aren't true for 64 bits code.
Most importantly, the size of the pointers and the size of ints.
On most 32 bits platform both are 32 bits. But on most 64 bits platforms, pointers are 64 bits, while ints are 32 bits.
So if you need to store a pointer in an int (you should rarely need this, but it is done in UQM), you get into problems. There exists a type 'intptr_t' which is guaranteed to be big enough to store either which can be used.
Also, structures may have a different size. Either because they contain types that have a different size, or because they are padded to 64 bits. It happens that assumptions are made about the size of a structure that don't hold on a 64 bits environment. In UQM some structures are dumped to a saved game as a block. This is fast, but it leaves saved games incompatible between 32 and 64 bits systems.

As for the << and >> opeartors, what macros are you refering too? These operators are often used in macros to extract specific bits from an integer, set specific bits.
For instance, if bits 4 through 8 contain some value you want, you can do
    #define GET_BITS_4_8(x) (((x) >> 4) & 0xf)
The 'x >> 4' will return the value of x with the bits shifted  4 positions, so the bits you want are now 0 through 4. But the other bits still contain stuff you don't need (apart from the top 4 bits which were filled in with 0's after the shift), so you perform and & to take only the bits set in 0xf, which are 0 through 4.
Similarly, you can have macros to set specific bits in an int. For instance, to make an int with bits 4 through 8 set to a value contained in x (which should be no larger than 0xf), you could do 'x << 4'.
To make a value of an existing int y, with bits 4 through 8 set to a new value, you first need to have the value of y with the bits 4 through 8 cleared, and then | them with the new value. So
    #define SET_BITS_4_8(y, x) (((y) & ~0xf0) | ((x) << 4))
The y & ~0xf0 takes just the bits that are not set in 0xf0.

As for
    typedef  void (*PVOIDFUNC) (void);
this is a definition of a function pointer type.
You'd say
    void (*f) (void);
to make a pointer f to a function taking nothing as arguments, and returning nothing.
To make subsequent code more clearer, the typedef defines a type PVOIDFUNC, so that you can define f instead as
    PVOIDFUNC f;
Function pointers in C are ugly. They may be the worst part of C syntax and are not easy to understand. There's a pretty good site explaining all of it on http://www.function-pointer.org/ which may help you.
As an example of how ugly it can get, take a look at the C fun signal:
    void (*signal(int sig, void (*func)(int)))(int);
If you understand this, then you're beginning to grasp C functions. Smiley

Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Nate
Guest


Email
Re: UQM on Gentoo linux amd64
« Reply #8 on: October 20, 2005, 07:00:05 am »

I appreciate the explanation.  I've been working in servlets and jsps lately, but getting back to c/c++ is always refreshing!  Admittedly I have no experience with c so if you don't mind I will continue to post parts of the code that I have questions about. 
Logged
venenozo
Zebranky food
*
Offline Offline

Posts: 5



View Profile
Re: UQM on Gentoo linux amd64
« Reply #9 on: October 20, 2005, 01:59:37 pm »

I am running a true 64bit   environment  winxp64 service pack 1
UQM WORK FLAWLESSLY.. my specs are as follows


AMD ATHLON 4400+ ( Clawhammer)  Water
epox MB
2 gig pc 500 Ram verto
2x  WD  Raptors
 SB audigy 2 zs
Geforce 6800 ultra oc on water ...



i can not speak for linux  user but xp64 and uqm runs flawless...
thanks ,
Ven
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: UQM on Gentoo linux amd64
« Reply #10 on: October 20, 2005, 02:31:13 pm »

Yes, if you run the 32 bits UQM on a 64 bits system that can also do 32 bits mode, it will work. But it isn't possible yet to run UQM compiled for 64 bits natively.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
venenozo
Zebranky food
*
Offline Offline

Posts: 5



View Profile
Re: UQM on Gentoo linux amd64
« Reply #11 on: October 20, 2005, 02:55:10 pm »

right via the WOW64 emulator ... but none the less what a great game  i cant seem to name my ship  and captain  or to get my remixes to work they seem to work when i installed the game and even after the "time mod" but when i  installed  ship editing mod to try to rename my ship it defualted back to  the original 3do sfx.. is this happening on 32 bit systems as well?
 am i doing something wrong with the mods or is it a 64 bit emulation bug ?
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: UQM on Gentoo linux amd64
« Reply #12 on: October 20, 2005, 03:37:44 pm »

You can change the name of your ship and captain in the options menu. No need for mods.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
venenozo
Zebranky food
*
Offline Offline

Posts: 5



View Profile
Re: UQM on Gentoo linux amd64
« Reply #13 on: October 20, 2005, 04:54:47 pm »

i outsmarted my self again ..all working perfectly now ... the remixes really do the game a bit more justice they are awesome  and give the game a fresh new feeling..

but put it in the books uqm is perfect on xp64
Logged
Nate
Guest


Email
Re: UQM on Gentoo linux amd64
« Reply #14 on: October 20, 2005, 09:46:28 pm »

meep-eep,

is this what you mean by storing a pointer in an int?

(remember im a c++ guy for now  Grin )

   std::cout << "try to store a pointer in an int..." << std::endl;
   int * int_ptr;
   int test;
   int test2 = 34;
   int * int_ptr2; = (int *)test;
   
   int_ptr = &test2;
   std::cout << "test2: " << test2 << std::endl;
   std::cout << "int_ptrs address: " << int_ptr << std::endl;

   test = (int)int_ptr;
   std::cout << "is tests value the same? : " << std::hex << test << std::endl;

   int_ptr2 = (int *)test;
   std::cout << "int_ptr2 takes tests new value..." << std::endl;
   std::cout << std::dec << *int_ptr2 << " should be: " << test2 << std::endl;

now my box is 64 bit so I used the flag -m32 at compile time to get this to work.  i got a segmentation fault, of course, without it.
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!