Friday, September 17, 2010

A long way to OS X

One beautiful morning I decided to try out Mac OS X on my laptop (MSI EX625). There were several reasons:

  1. Apple hardware is too expensive.
  2. The OS quality is outstanding, while the price is just 40$.
  3. Need to try developing for Apple's mobile devices.
First facts I discovered was: "it is possible" and "there is TonyMac boot loader". Alright, I ordered a disk from eBay for 30$, starting to prepare myself mentally for a change.When the disk arrived, I was eager to try out tony's boot loader. Chameleon appeared on the screen, inviting me to start the installation. The first try failed - it couldn't reach the installer window, hanging half the way through.

I searched forums and started trying different boot options. Nothing actually helped. There were several errors on the screen, what confused me a lot, especially because an actual error causing the hang was not mentioned... I tried all possible ATI versions of iBoot (4+) and even PcEfi with no result. I've posted on the forums, waited, searched, but hadn't gotten any replies...

After heavy surfing I found out the actual reason - ATI Radeon Mobility video-cards are not supported! There was a chance that drivers could be released soon, but I couldn't wait, especially an undefined amount of time. I decided to exchange laptops with my wife, leaving old hard-drives. She didn't stop me, so I started to disassemble both laptops immediately, with a help of a small screwdriver. My new laptop was ASUS M51SN, with ultra-compatible GeForce 9500M on board.

Both Linuxes survived this change with honor: my Arch required to change the video driver, while Dina's Ubuntu worked perfectly like nothing changed (though, she updated the driver later). Mac OS X still didn't run out of the box, but required the following options: '-x' for safe mode, 'cpus=1' for proper cpu cores detection. That was sufficient, but I patched the BIOS using a custom version to enable proper CPU detection (the BIOS built-in update utility is awesome!).

Hello, the freaking installer! It wasn't easy at all to get you on the screen! I was happy for a short moment - the installer didn't like my MBR disk at all... Apple supports only GUID & Apple partition tables, intentionally ignoring MBR. There was a solution - to use the external USB disk/flash: to install on it first, and copy the partition to the hard drive directly. My 4Gb flash wasn't enough, and the official website states 5Gb requirements. Borrowing a 8gb USB flash was not enough as well, because the minimum installed configuration took 8.2Gb, what a surprise!

That was a time to sacrifice my precious 1Tb external USB drive. There was no space to backup to, so I decided to trick the installer a bit. I moved the actual data partition +20Gb from the start of the disk, leaving the empty space for the Mac OS image. I backed up the MBR together with first 100Mb of the FAT32, just to make sure the file system structure is saved. In the installer, I re-partitioned the drive into GUID 2 partitions : first 20G for Mac OS and all the rest. The installation went successful, yaw!

I copied the partition to the hard drive and was even able to boot from it: in a safe mode, using the same cd loader. Moreover, putting the old MBR back on the external HDD recovered it instantly, leaving me with a feeling of the epic win :) However, the OS X file system became corrupted each time I booted, forcing me to rewrite it from the image and look forums for an answer...  Posting again and asking for help in the OSX-86 IRC didn't help, leaving me in frustration again...

The sorting of my MBR seemed to be a good idea, if not for the corruption problem, but at least to make the boot loader work on the HDD. Fdisk did the job, but MBR was somehow damaged after that. I looked for a rescue and accidentally issued 'dd' command on the saved 100Mb file from my external drive backup... That was a bi-i-ig mistake, and it seemed to be the worst situation ever: the partition table together with my ext4 file systems were destroyed, so I had no OS to boot and no data to operate!

That's where smart hackers come into play. Asking again on the IRC, I attracted the attention of 'aschar', who listened to my problems and described the way out, in detail. The solution was to use a much less known Nawcom boot loader, that recently gained MBR support. In a day I managed to rebuild the partition table, entering some numbers by hand and using a couple of hack tools (look at testdisk!).

Using the PartedMagic liveCD I prepared the case-sensitive HFS+ partition and started Nawcom's boot loader. From now on, everything was smooth. The boot loader didn't require the safe mode, allowing me to install OS X right into the MBR partition I provided. After reboot, the OS loaded correctly, allowed me to update it to 10.6.4 and install MyHack tools from the same CD. No file system corruption, good driver support (though, sound & wifi are in progress) - and now I'm a happy owner of the Mac OS X laptop!

The end of story. The moral is:
  • Always look for alternatives! What is more popular is not always of better quality.
  • Always backup, at least MBR! Be careful with 'dd' and 'sudo' in general. Think, then do.
  • Don't give up!

Wednesday, January 13, 2010

OpenGL revenge!

When I started my gaming life, there were many competing graphics API created by software companies & hardware manufacturers:

  • Direct3D (all: Microsoft)
  • OpenGL (all: open standard, ARB group)
  • Glide (3Dfx only)
  • MeTaL (S3 only)
The last two performed very well, but only on the corresponding hardware. Unreal Tournament & Deus Ex where the best games to test all these render modes in action.
Time passed, and Glide & Metal silently died, leaving GL competing with D3D, having only a single guard: Id Software. I can only guess what would happened to GL at that time if there was no John Carmack (Id lead programmer)... S3 technology was bought my MS that spread S3TC wisdom all over the word.

OpenGL standard developed very slowly, but easy extension mechanism allowed programmers to use all the new features Direct3D contained, and even more. Microsoft performed a massive information attack on GL (see FUD) leaving only cross-platform games alive.

Now there is XNA, Win7 with its DX11 and hordes of MS fans lurking around with their XBox'es. Other camp primarily consists of Unix/Linux systems, Mac OSX and a bunch of smart embedded devices including PS3. As far as I see, the time of revenge has finally come!

OpenGL ES (at least 2.0) has a very successful design: simple, portable, effective. It was developed by Khronos group that is now pushing forward OpenGL-3 standard. Microsoft was not able to spread it's massive OS on mobile devices, and now we have numerous game-dev companies working on iPhone & PS3 games using OpenGL ES only. Moreover, Linux & Unix community grows: they might not be willing to pay for games, but they are developing exclusively on GL. At the same time, we have Mac OSX users that easily afford themselves buying games, forcing major titles being released for this OS (take Dragon Age for example).

The conclusion is: there is no point to develop your engine primarily for Direct3D unless you want to run on XBox. OpenGL successfully covers all other platforms (there is only a little difference between ES and normal GL nowadays), has a clear extensible design and an open standard. Congratilation, my friends, our victory is close! And the world will be a little better place to live soon :)

P.S. Some people say you don't have to choose and support both API anyway. That's true, but don't forget about the future: your choice may shift the balance in this fight giving an initiative to the hands we can't trust.

Thursday, January 7, 2010

Dev Status

A good start to run is to know where we are.

Compression: abandoned.
Pending: dark & archon support.
Ideas: doubling BWT sort on GPU/OpenCL.

Artificial Intelligence: abandoned.
Pending: NN self-development, experiments.
Ideas: rewrite in Boo + OpenTK.

Graphics: active.
Focus: kri, shading, computations.

Work: active.
Focus: physics, fur, water.

Internet: active.
Focus: project storage.

Network: abandoned.
Pending: marian, dracon & farpost support.
Ideas: password hash cracking on GPU.

Well, you can see lots of abandoned areas with interesting projects. What can I say... it's all about games, work & private life. I hope to revive at least some of them in future.


Welcome everybody!

This blog is not about feeling, neither about research achievements. It's not about anything in particular. It's just a scrapyard of my thoughts willing to be left in digital form (freeing space for more useful ones).

No rules, no promises. Enjoy! :)