UFO: Alien Invasion Issue Tracker
UFO: Alien Invasion
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png UFO: Alien Invasion / Closed Bug report #479 Code doesn't work on PowerPC because of memory misalignment
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "Not determined".
Issue basics
  • Type of issue
    Bug report
  • Category
    General
  • Targetted for
    Not determined
  • Status
    Closed
  • Priority
    3. Normal
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
  • Estimated time
    Not estimated
Issue details
  • Resolution
    Not determined
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Complexity
    Not determined
  • Platform
    Not determined
  • Architecture
    Not determined
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
[http://sourceforge.net/p/ufoai/bugs/479 Item 479] imported from sourceforge.net tracker on 2013-01-28 18:21:29

The Com_ParseValue function of game/q_shared.c reads in bytes, integers and floats and packs them tightly in memory. If it first reads a byte and then a float, on PPC this causes a bus error because the float isn't properly aligned. On PowerPC, floating point values have to be 4-byte aligned, which obviously isn't the case when a byte is read followed by a float.

This function's design has to be changed. Perhaps a better version (or at least, ideas) can be snarfed from another Q2-based project that is known to work on PPC?
===== Comments Ported from Sourceforge =====

====== tlh2000 (2007-01-02 09:33:06) ======

Logged In: YES
user_id=116930
Originator: NO

this function is ufo:ai only - afaik - so no 'snarfing' is possible here (correct me if i'm wrong)
====== airhead (2007-01-03 22:13:29) ======

Logged In: YES
user_id=5398
Originator: YES

Here's an alignment hack. This is possibly quite heavy on resources (using just less than 4 times as much memory on PPC than i386 in the worst case), but at least it makes the game get to the main screen (and other archs don't suffer from the memory hogging). There are still issues left, the menu doesn't display the menu items text correctly and sometimes I see weird rendering artifacts in the menu screen (these may be problems with Mesa's software rendering, though).

It might be worthwhile to drop manual memory management in favor of malloc()/free() based memory management. This means memory will always be properly aligned. Unfortunately, changing the design of the parser requires quite a bit of work.

Unfortunately, as there's no software renderer for UFO:AI, I will not be able to continue work on porting efforts. Mesa's software rendering is just too slow. This is probably my last contribution to this project (until there's decent free hardware acceleration software). Best of luck with the project!
File Added: ufoai.diff
====== sf-robot (2007-01-21 03:20:05) ======

Logged In: YES
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Steps to reproduce this issue
Nothing entered.
Todos (0 / 0)
Issue created
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif