Downloading FAH Core files manually

From FaHWiki
Jump to: navigation, search

Depending on the WU the FAH client will download a suitable fahcore file (.fah or .bz) from the Stanford FAH servers. You can also download these files by hand, but these are not usable as is. Under linux you have to download the .bz file and extract it. Windows and MacOSX users have to download the .fah wrapped file and convert it before extraction.

Note 1: Not every FAH core has .bz file available.
Note 2: The most common reason for downloading FahCores manually is a repeated failure of the automatic download. In many cases, the repeated failures are the result of a corrupt copy in your browser cache. Before attempting this procedure, manually empty your browser cache and allow the client to try again.

For interested parties, the .fah file structure is simple enough to easily make a wrapper from a .fah file to a .bz file - just seek to position 0x200 in the .fah file and dump the rest into a file with a extension. This technique is used in the instructions below.

Core download locations:

NOTE: Windows Vista users who installed a F@h client in the C:\Program Files\<fah folder> may experience a fahcore download error due to the higher default security settings in that OS. This problem is easily corrected by setting the fah executable to Run As Administrator.

Instructions for manually downloading and extracting FahCore files
Note: If both .bz and .fah files exist, download whichever is the most recent based on the timestamp.

  1. Tools required
    • To extract the core files you will need an archive program capable of extracting .bz files (the files are actually bz2 with a .bz file extension). Linux and Mac OS X users will most likely have bunzip2 (bzip2) already included in their distro, Windows users can use WinRar to extract the .bz files.
    • If you need to convert a .fah file to a .bz you will also need a hex editor. A text editor will NOT work!. Windows users can use XVI32, Linux users can use KHexEdit, Mac OS X users can use Synalyze It! or HexEditor. Note that a hex editor is not required if you have the "tail" utility available (most Linux and OSX systems are equipped with this), see below.
  2. Dealing with the .fah file (only required if no .bz file exists)
    • Navigate to to the core location for your OS (above) and download the relevant .fah file. See here if you are unsure which core you need.
    • Open up the .fah file you just downloaded in your hex editor. Navigate to position 0x200 [hex], or 512 [decimal] (all hex editors will be able show the position in both hex and decimal) and delete everything before it. In hex, the value at 0x200 (512) is 42, in decimal the value is B.
      Note: If you have the "tail" utility, as is common on Linux and MacOSX installations, you may simply type tail -c +513 file.fah > - a hex editor is not required in that case. Windows by default does not include such a utility.
    • After deletion the first value in the file should then be 42 (B)
    • Now you should save the file to where xx is the core number.
    • Do not open it yet, follow the steps below.
  3. Dealing with the file. (Applies to both downloaded and unwrapped-from-.fah versions)
    • Open up the file in your archive program and simply extract the .exe within to your F@H folder.
    • Rename the Core_xx.exe file to FahCore_xx.exe

Note: It seems that some earlier versions of Winrar do not handle .bz files as expected with regard to the naming convention of any files contained within. If this happens, extract the file, which will probably be named Core_xx (with no extension) and manually rename it to FahCore_xx.exe (xx still refers to the core number).

Extracting the latest FahCore_a0:
The procedure documented above will not work for the latest FahCore_a0, because it now delivers two files, not one. Here is the procedure how to extract it:

  • 1. Download Core_a0.fah and edit by the above method, with 1 exception - save it as, not
  • 2. Extract the and open the extracted file (must be Core_a0) with HEX editor.
  • 3. Go to position 48 and delete everything before that.
  • 4. Go to position 194800 and delete everything after that.
  • 5. Save the file as FahCore_a0.exe.
  • 6. Open again Core_a0.
  • 7. Go to position 194890 and delete everything before that.
  • 8. Save the file as libfftw3f-3.dll.

Third Party Tools
You can also use FoldingForum: CoreDownloader, which basically automates the process described in this wiki page.

'Shell script for Unix/Linux/Unix-like operating systems'

FAH_PLATFORM=$(echo $CORE_DOWNLOAD_PATH | cut -d\/ -f5)
which curl && DLCMD="curl -s"
which wget && DLCMD="wget -q -O -"
if [ -z "$DLCMD" ] || [ ! "$DLCMD" ];then
    echo "No download client was found, please install curl or wget and ensure they are located within you path"
    exit 1
for CORE in `$DLCMD $CORE_DOWNLOAD_PATH | sed -n 's/.*href=\"\(.*\.fah\)\".*/\1/p'`;do
    case $CORE in
            if [ $FAH_PLATFORM = "Win32" ];then
                echo "Downloading $CORE"
                $DLCMD $CORE_DOWNLOAD_PATH$CORE | tail -c +513 | bunzip2 -qdc > FahCore_a0.tmp
                echo "Extracting FahCore_a0.exe"
                head -c +1656976 FahCore_a0.tmp | tail -c +73 | sed -e 's/PAPADDINGXX.*//g' > FahCore_a0.exe
                echo "Extracting libfftw3f-3.dll"
                tail -c +1656977 FahCore_a0.tmp > libfftw3f-3.dll 
                rm -f FahCore_a0.tmp
                echo "Downloading and extracting $CORE"
                $DLCMD $CORE_DOWNLOAD_PATH$CORE | tail -c +513 | bunzip2 -qdc > $(echo $CORE | sed -e 's/\.fah/\.exe/g' -e 's/^/Fah/g')
            echo "Downloading and extracting $CORE"
            $DLCMD $CORE_DOWNLOAD_PATH$CORE | tail -c +513 | bunzip2 -qdc > FahCore_a4.exe
            echo "Downloading and extracting $CORE"
            $DLCMD $CORE_DOWNLOAD_PATH$CORE | tail -c +513 | bunzip2 -qdc > $(echo $CORE | sed -e 's/\.fah/\.exe/g' -e 's/^/Fah/g')

Substitute the CORE_DOWNLOAD_PATH variable's value with any of the above listed Core download locations.
Shell script requires a cli download program such as either curl or wget and the tail, bunzip, sed, cut commands.
Tested on Linux and should potentially work under Mac OS X, BSD and Cygwin provided the required commands are installed.
Will not work correctly download and extract FahCore_a0 as mentioned above, this feature maybe added later.

Reference Links

Personal tools