July Development Report

While adding support for new games tends to get the most visibility, we also aim to improve our support for already-working titles. Users have reported that later Oblivion patches were encountering a crash when trying to load a save from within the game. Tracking down the solution to this issue proved to be difficult, since the obvious data suggested a reference counting issue in the Direct 3D implementation in Cedega causing a crash in the game's code. The real cause turned out to be completely unrelated. The Windows API provides an implementation for Thread Local Storage (TLS) that allows threads to manage global storage unique to each thread. When a TLS slot index is allocated, each thread uses that slot index to maintain its unique data. When the application no longer needs that TLS slot, any thread can call TlsFree to free that slot in all threads. Cedega's implementation of TlsFree failed to implement the exact behavior Windows implements; it only marked the slot as available for use after TlsFree was called. Windows zeroes the contents of the slot for each thread when TlsFree is called. For Oblivion, this missing behavior caused a problem when the TlsAlloc routine was called shortly after a TlsFree call, returning as its newly allocated index the one that had just been released. One of the threads in Oblivion then called the TlsGetValue before calling TlsSetValue and ended up with a stale value, the use of which lead to the aforementioned crash while loading saved games. The Cedega TlsFree implementation has since been improved to match the Windows behavior, which seems to clear up this issue quite nicely.

Some users recently reported that sound started dropping out on them while playing games after their distribution updated to ALSA 1.0.16. Testing with various sound settings in Cedega revealed that sound only dropped out when the mmap option was enabled. The mmap option improves performance for some games by eliminating the need to copy sound data multiple times in memory. Research seems to indicate that there is a bug in ALSA that can sometimes occur with a subset of sound cards. When that bug is triggered, it causes Cedega to get out of synchronization and the sound playing never recovers. To address this situation, the Cedega mmap code robustness has been improved to detect when synchronization fails, and attempts to recover from the situation. The beta team users experiencing the issue have reported that this recovery mechanism solves this issue for them.

On the graphics side, we are always investigating possibilities for improving on the performance of our Direct3D layer. Sometimes these attempts pan out and result in fantastic performance gains; sometimes they don't. Recently, we investigated why performance degrades when using GLSL and noticed that a non-trivial amount of time was being spent uploading shader constants to the drivers. There are differences in how Direct3D treats shader constants versus OpenGL, so we naturally end up with some overhead when a game uses vertex or pixel shaders (as basically all major games do now). One OpenGL extension that we thought might help combat this issue was EXT_bindable_uniform, which lets applications share a group of shader constants between multiple GLSL programs. However, after quite a bit of investigation and benchmarking, it was found that this extension didn't result in any positive gains for us yet. We are continuing to dig into this and experiment with ways that can yield performance enhancements for translated shaders.

While Cedega benefits from much of the work done for Cider, Cedega does have some areas of technology particular to it that aren't necessary on the Cider side. One area in particular that has hindered our desire to support Cider titles under Cedega has been installer issues. We don't use the game installers on the Mac, but under Cedega, if you can't install the game, we don't feel comfortable considering it supported. As has been previously mentioned, we've been addressing some of those installers via added MSI support. Another class of installers that weren't working under Cedega were InstallShield 7 installers. Installers often use different areas of the Win32 API than the games they install and thus need specific attention to get working. In this case, InstallShield 7 makes greater use of COM objects, in particular passing COM objects between multiple threads, than previous versions have. Improving support for this technology will help with installers for newer games like Civilization IV: Beyond The Sword, Need for Speed: ProStreet, and SPORE Creature Creator.

Finally, some games, Steam in particular, will embed a web browser inside of a window. Under Windows, this embedding uses Internet Explorer which is not available on Linux. Cedega currently has support for embedded web browsers, support which is built upon the Mozilla ActiveX project. However, this project is no longer active and while the existing implementation provides some essential pieces, it is not complete. We are currently working on updating our web browser control, both to improve compatibility with the Internet Explorer COM interface, but also to allow use of updated rendering engines and make it easier to update the rendering engine in the future.

Mark Adams
Development Manager
TransGaming Technologies
Broadening the Playing Field