Homesource Forums

Homeworld Source Editing Talk
It is currently Tue Jul 25, 2017 7:36 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Tue Feb 20, 2007 12:14 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
Brought on by the rev 484 replacment of ShipDef #defines.

The capture of an enemy frigate and subsequent triggering of NIS 3 in Mission 03 causes a segfault.

So the game is looking for a misplaced ship?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 6:01 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 61
Variables of ShipType are abused and may contain all kinds of stuff, such as pointers. These guys apparently haven't heard of unions. Something in this bogus type-punning apparently broke when ShipType was changed from unsigned to signed (because the enum contains -1). It is unclear to me what exactly that was.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 7:54 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
Business as usual.... folks make efforts to clean up the... interesting... parts of the code and things break right and left.

It's all good. Because otherwise the rest of us might never have a clue as to what all is going on inside there... Ganbatte, aunxx! Fight-O, lmop! :D


Top
 Profile  
 
 Post subject: Fixed
PostPosted: Wed Feb 21, 2007 7:33 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 61
Right. I changed ShipType back to udword to get this fixed, if not very elegantly. If someone manages to hunt down the NIS code that was actually broken by the signedness change, we can then change it back.


Top
 Profile  
 
 Post subject: Re: Fixed
PostPosted: Wed Feb 21, 2007 8:45 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
shevek wrote:
Right. I changed ShipType back to udword to get this fixed, if not very elegantly. If someone manages to hunt down the NIS code that was actually broken by the signedness change, we can then change it back.


Hmmm... please take the following with humor and perhaps a grain of salt...

First, did you fixme the code you put back in so it can be located later?

But as I see it there's no urgent need to put back wonky code just because something broke when the wonkiness was removed. The purpose in changing it in the first place was to try to fix what's buggy, strange, erratic or just plain weird about the code.

Now, this fixme isn't a bad move as is because the #17 bug had been around so long that a semi-stable revision with it solved and this fixme in place can be useful... but I just don't think we should be in a great hurry at any time to put back bad code just because something broke. After all, we don't have a shipping date to meet ;)

Comments, refutations, error correction, torches, and pitchforks are welcome...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 4:17 am 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 61
The code that I put back is not particularly wonky. It should be no big deal whether one uses an enum or any integer type to represent ShipType. Apparently, however, it is a big deal, because some wonky code elsewere (presumably NIS.c) does weird things with ShipType. It is this code that should be replaced with something cleaner. Unfortunately I was unable to locate the precise wonkiness that depends on the signedness, although I have a bit of a hunch. If someone else has a keener eye, good. Otherwise one could start to replace all wonky code systematically, but that is a huge task. Once the wonky code is gone, one can try to change ShipType again to see if anything breaks.

AFAIK, the C compiler is free to represent an enum as any integer type it will fit in. So in principle, ShipType could have become a signed char. Good luck trying to fit a pointer in that. Fortunately, GCC on ia32 does seem to choose signed long, which is big enough to contain pointers. Unfortunately there appears to be a sign extension lurking somewhere, because signedness seems to make a difference.

Notice that ObjType.h contains quite a few enums, but none of them contain negative members, and GCC apparently prefers to represent such enums as unsigned (other compilers may vary). Who knows what would break if any of those enums were signed?

Marking this as FIXME sounds like a reasonable idea, which, unfortunately, did not occur to me at the time.

I think there should be a version of Homeworld SDL that one can actually use to play the game. The web pages still present the 0.3 binaries. They work pretty well but have a weird issue with Radeons and do not contain movie support. Also, the 0.3 source does not compile with recent versions of GCC, thus maintenance of the 0.3 release has become difficult. We may not have a release date but having a new release would be good.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 4:19 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

I checked out 494 this morning, and my saves for Mission 3 no longer work, but the start of the level is okay. :)

Are all the NIS sequences correct for this mission now? I tried playing the level this morning and whilst it doesn't segfault, I'm not sure if it's missing a NIS. :?

Aunxx


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 6:17 am 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
shevek wrote:
The code that I put back is not particularly wonky. It should be no big deal whether one uses an enum or any integer type to represent ShipType. Apparently, however, it is a big deal, because some wonky code elsewere (presumably NIS.c) does weird things with ShipType.


"Wonky" is a good term for the divers and differing ways the game breaks if anyone is so unfortunate as to dare to add a ship type. While lmop didn't state that this was what he was specifically after, any research in the area of ships is going to break the game. Often, probably :)

shevek wrote:
... Otherwise one could start to replace all wonky code systematically, but that is a huge task.


... which is exactly what lmop has undertaken.

lmop and the game go back a ways.

shevek wrote:
Once the wonky code is gone, one can try to change ShipType again to see if anything breaks.


You mispelled "to see what breaks next" :)

The breaking part is inevitable because the Homeworld Source Code Wonkiness is an exercise in infinite recursiveness; the most we can do is attain new levels of useability and stability. Even when the original source code is completely replaced it will still be... wonky :)

And the ability to modify the ship types is the only definite in the future of Homeworld SDL.

shevek wrote:
Marking this as FIXME sounds like a reasonable idea, which, unfortunately, did not occur to me at the time.


Easily fixed... :)

shevek wrote:
I think there should be a version of Homeworld SDL that one can actually use to play the game.


Hmmm... actually... the new release has been out since December....

http://homesource.nekomimicon.net/downl ... or_testing

... did I mention that I'm behind in things like updating the web page?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 6:37 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hmmm.

Can anyone else save and the reload the game in Mission 3 as it crashes for me now.

Or any level....... :shock: :shock: :shock:

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 6:40 am 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
aunxx wrote:
Hi.
Are all the NIS sequences correct for this mission now?


While there's multiple instances of the dreaded "pseudo-NIS" in this particular mission (where control and focus are yanked away from the player but the player can still give orders to ships... and have ships killed) there is only one actual NIS.

The "pseudo-NIS" sequences were unaffected by the NIS bugs anyway.

aunxx wrote:
I tried playing the level this morning and whilst it doesn't segfault, I'm not sure if it's missing a NIS. :?


NIS 3 plays in Linux, although there's something peculiar about the Kharak defense unit...
http://homesource.nekomimicon.net/downl ... _NIS_3.avi


Top
 Profile  
 
 Post subject: fixme
PostPosted: Thu Feb 22, 2007 5:50 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 61
OK, marked the changes as FIXME for Linux and Windows. Left out Mac because lmop said it is not affected.

Does anybody know precisely which SVN revisions the 0.3 and 0.4 releases correspond to? It would be useful to tag them.


Top
 Profile  
 
 Post subject: Re: fixme
PostPosted: Thu Feb 22, 2007 11:49 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
shevek wrote:
OK, marked the changes as FIXME for Linux and Windows. Left out Mac because lmop said it is not affected.


lmop needs to install a dual-boot with linux on his Mac... ;)

shevek wrote:
Does anybody know precisely which SVN revisions the 0.3 and 0.4 releases correspond to? It would be useful to tag them.


It's near the top of the INSTALL document included in the release.

Quote:
Current Subversion revision as of this update: r435


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group