Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.
Zero Tolerance for Disrespect

[PSX] This is Football 1 & 2 - Help to decompress the file inside FOOTBALL.CFS

Featured Replies

Solved by Rabatini

  • Supporter

image.png

Maybe there are more than one algo involved. See the differencies at compressed size. Unknown_1 > 2 is less compressed as 1.

  • Supporter
  • Solution
On 11/27/2026 at 7:22 AM, BloodRaynare said:

TIF.zip

AnonBaiter / RetingencyPlan already makes a script for them but it didn't handle the compression. From my research it seems to be some kind of form of LZ77.

I’ve updated the QuickBMS script to extract and decompress the files from both games.

Your LZ77 suspicion was correct: it uses literal runs and backward references. The stream is divided into 2,048-byte sectors, with the last two bytes reserved for a sector number. There’s also padding between sectors that needs to be skipped.

The script handles TIF1’s uncompressed animations and two camera scripts whose first sector is XOR-obfuscated, as well as TIF2’s padded file sizes.

I tested it on entries from both supplied archives, including those special cases. The extracted files retain their original names and folder structure.

I wrote a few comments in the script for you to understand.

# FOOTBALL.CFS - This is Football / This is Football 2 (PS1)

endian little
idstring "CFS "
getdstring VER 4
getdstring CREDIT 4
getdstring YEAR 4
getdstring RESERVED 16
get HEADER_SIZE long
get FILES long
get NAME_OFF long
savepos INFO_OFF
get ARCHIVE_SIZE asize
if VER != "3.1 " && VER != "4.2 "
    print "Unsupported CFS version: %VER%"
    cleanexit
endif

goto NAME_OFF
for i = 0 < FILES
    get NAME string
    putarray 0 i NAME
next i

goto INFO_OFF
for i = 0 < FILES
    getarray NAME 0 i
    get XSIZE long
    get SIZE long
    get OFFSET long
    get TIMESTAMP long
    get FLAGS long
    savepos NEXT_INFO
    math LIMIT = OFFSET
    math LIMIT += SIZE
    if OFFSET < HEADER_SIZE || LIMIT > ARCHIVE_SIZE
        print "Invalid payload bounds: %NAME%"
        cleanexit
    endif
    if VER == "3.1 "
        if FLAGS != 1 && FLAGS != 2
            print "Unsupported flags: %NAME%"
            cleanexit
        endif
    else
        if FLAGS != 0x10800
            print "Unsupported flags: %NAME%"
            cleanexit
        endif
    endif
    log MEMORY_FILE OFFSET SIZE

    # Two TIF1 CSBs start with the XOR-encoded form of "\x40CSB V1.0".
    if SIZE >= 9
        getvarchr SIG0 MEMORY_FILE 0 long
        getvarchr SIG1 MEMORY_FILE 4 long
        getvarchr SIG2 MEMORY_FILE 8 byte
        if SIG0 == 0x05440457 && SIG1 == 0x69261137 && SIG2 == 0x27
            math XOR_END = SIZE
            if XOR_END > 2048
                math XOR_END = 2048
            endif
            for j = 0 < XOR_END
                getvarchr B MEMORY_FILE j byte
                math K = j
                math K &= 1
                if K == 0
                    math B ^= 0x17
                else
                    math B ^= 0x47
                endif
                putvarchr MEMORY_FILE j B byte
            next j
        endif
    endif

    log MEMORY_FILE2 0 0
    putvarchr MEMORY_FILE2 XSIZE 0 byte
    math OUT = 0
    for SECTOR = 0 < SIZE
        if OUT >= XSIZE
            break
        endif
        math END = SECTOR
        math END += 2046
        if END > SIZE
            math END = SIZE
        endif
        math FULL_END = SECTOR
        math FULL_END += 2048
        if FULL_END <= SIZE
            math FOOT_POS = SECTOR
            math FOOT_POS += 2046
            getvarchr FOOT MEMORY_FILE FOOT_POS short
            math EXPECT = OFFSET
            math EXPECT += SECTOR
            math EXPECT /= 2048
            math EXPECT &= 0xffff
            if FOOT != EXPECT
                print "Invalid sector footer: %NAME%"
                cleanexit
            endif
        endif
        goto SECTOR MEMORY_FILE
        if FLAGS == 2
            math COUNT = END
            math COUNT -= SECTOR
            math REMAIN = XSIZE
            math REMAIN -= OUT
            if COUNT > REMAIN
                math COUNT = REMAIN
            endif
            getdstring RUN COUNT MEMORY_FILE
            goto OUT MEMORY_FILE2
            putdstring RUN COUNT MEMORY_FILE2
            math OUT += COUNT
        else
            savepos POS MEMORY_FILE
            do
                if POS >= END || OUT >= XSIZE
                    break
                endif
                get CTRL byte MEMORY_FILE
                if CTRL == 0
                    # One or two zero bytes pad the end of a sector's data.
                    math PAD = END
                    math PAD -= POS
                    if PAD > 2
                        print "Unexpected zero token: %NAME%"
                        cleanexit
                    endif
                    break
                endif
                if CTRL < 0x80
                    math COUNT = CTRL
                    savepos POS MEMORY_FILE
                    math CHECK = POS
                    math CHECK += COUNT
                    if CHECK > END
                        print "Truncated literal: %NAME%"
                        cleanexit
                    endif
                    math CHECK = OUT
                    math CHECK += COUNT
                    if CHECK > XSIZE
                        print "Output overrun: %NAME%"
                        cleanexit
                    endif
                    getdstring RUN COUNT MEMORY_FILE
                    goto OUT MEMORY_FILE2
                    putdstring RUN COUNT MEMORY_FILE2
                    math OUT += COUNT
                else
                    savepos POS MEMORY_FILE
                    math CHECK = POS
                    math CHECK += 2
                    if CHECK > END
                        print "Truncated backward reference: %NAME%"
                        cleanexit
                    endif
                    get DIST short MEMORY_FILE
                    math COUNT = 256
                    math COUNT -= CTRL
                    math CHECK = OUT
                    math CHECK += COUNT
                    if DIST == 0 || DIST > OUT || CHECK > XSIZE
                        print "Invalid backward reference: %NAME%"
                        cleanexit
                    endif
                    math SRC = OUT
                    math SRC -= DIST
                    # Copy in words only when overlap permits it.
                    if DIST >= 4
                        for COUNT = COUNT >= 4
                            getvarchr B MEMORY_FILE2 SRC long
                            putvarchr MEMORY_FILE2 OUT B long
                            math SRC += 4
                            math OUT += 4
                            math COUNT -= 4
                        next
                    endif
                    for j = 0 < COUNT
                        getvarchr B MEMORY_FILE2 SRC byte
                        putvarchr MEMORY_FILE2 OUT B byte
                        math SRC += 1
                        math OUT += 1
                    next j
                endif
                savepos POS MEMORY_FILE
            while POS < END
        endif
        math SECTOR += 2048
    next
    if OUT != XSIZE
        print "Short output: %NAME%, got %OUT%, expected %XSIZE%"
        cleanexit
    endif
    log NAME 0 XSIZE MEMORY_FILE2
    goto NEXT_INFO
next i

football_cfs.zip

Edited by Rabatini

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.