Skip to content

Instantly share code, notes, and snippets.

@1UPNuke
Last active July 12, 2021 17:14
Show Gist options
  • Select an option

  • Save 1UPNuke/d696352dcc2327c9b12a560337afac32 to your computer and use it in GitHub Desktop.

Select an option

Save 1UPNuke/d696352dcc2327c9b12a560337afac32 to your computer and use it in GitHub Desktop.
Reverse engineered description of the `cuplayout.cup` file used to store custom cup layouts in CTGP Revolution.

cuplayout.cup documentation

I reverse engineered the cuplayout.cup file used to store custom cup layouts in CTGP Revolution.

Below is an in-depth explanation of the file format.

Table of contents

  1. Header
  2. Cup count
  3. Tracks
    1. Tracklist
  4. Example file

Header

The header block takes up the first 7 bytes of the file. These bytes correspond to the ASCII characters "CUP2", followed by three null bytes (43 55 50 32 00 00 00)

Cup count

These are then followed by a single byte denoting the amount of cups in the custom layout, currently with a maximum value of 0x36 (54 in decimal).

Tracks

The rest of the file is (cup count) × 4 bytes in sets of four denoting the tracks present in each cup in order from 1 to (cup count).

Presently it is not possible to have cups with more or less than four tracks.

Here is an example cup, containing 4 tracks: 20 21 22 23

Tracklist

The tracks are as of 2021/05/16 denoted as so, starting from 0x20:

0x20 = GCN Dry Dry Desert
0x21 = GBA Riverside Park
0x22 = Siberian Chateau
0x23 = Concord Town
0x24 = Big Express City
0x25 = Lost Fortress
0x26 = DKR Jungle Falls
0x27 = Colour Circuit
0x28 = DS Bowser Castle
0x29 = DS Shroom Ridge
0x2A = Daisy's Palace
0x2B = GBA Peach Circuit
0x2C = Celestial Ruins
0x2D = Shy Guy's Market
0x2E = GBA Sunset Wilds
0x2F = N64 Luigi Raceway

0x30 = GBA Rainbow Road
0x31 = Halogen Highway
0x32 = Colour Wonderland
0x33 = Flowery Greenhouse
0x34 = Item Fireland
0x35 = Rock Rock Ridge
0x36 = Star Slope (Hidden)
0x37 = NONE
0x38 = NONE
0x39 = N64 Rainbow Road (Hidden)
0x3A = NONE
0x3B = Alpine Peak
0x3C = Daisy Hillside
0x3D = Seaside Circuit
0x3E = Wuhu Island
0x3F = Pinewood Path

0x40 = Mushroom Peaks
0x41 = Water Village 
0x42 = NONE
0x43 = NONE
0x44 = SNES Bowser Castle 2
0x45 = Honeybee Hideout
0x46 = Waluigi's Motocross
0x47 = SNES Mario Circuit 1 
0x48 = Rosalina's Snow World
0x49 = Cottonplant Forest
0x4A = Flying Kingdom
0x4B = Sky Shrine
0x4C = Sakura Sanctuary
0x4D = ASDF_Course
0x4E = Desert Fort
0x4F = Rush City Run

0x50 = Icecream Sweetland
0x51 = Incendia Castle
0x52 = Sunset Forest
0x53 = The Rabbit Hole
0x54 = Haunted Gardens
0x55 = DKR Star City
0x56 = Kartwood Creek
0x57 = Fishdom Island
0x58 = GCN Rainbow Road
0x59 = N64 Royal Raceway
0x5A = Spectral Station
0x5B = DS Airship Fortress
0x5C = Six King Labyrinth
0x5D = Lunar Lights
0x5E = SNES Donut Plains 2
0x5F = Jungle Cliff

0x60 = Nightlife Party
0x61 = Undiscovered Offlimit
0x62 = Yoshi Lagoon
0x63 = Skyline Avenue
0x64 = GCN Bowser's Castle
0x65 = GBA Bowser Castle 4
0x66 = DS Waluigi Pinball
0x67 = N64 Choco Mountain
0x68 = N64 Banshee Boardwalk
0x69 = GBA Broken Pier
0x6A = GCN Yoshi Circuit
0x6B = Summer Starville
0x6C = Luncheon Tour
0x6D = Quaking Mad Cliffs
0x6E = Delfino Island
0x6F = Dawn Township

0x70 = GBA Cheep Cheep Island
0x71 = SNES Choco Island 2
0x72 = Twin Peaks
0x73 = DS Figure-8 Circuit
0x74 = GCN Daisy Cruiser
0x75 = DS Wario Stadium
0x76 = Sunset Circuit
0x77 = DS Cheep Cheep Beach
0x78 = SNES Mario Circuit 2
0x79 = Candy Coaster
0x7A = Melting Magma Melee
0x7B = Final Grounds
0x7C = Pipe Underworld
0x7D = Canyon Run
0x7E = New Moon Manor
0x7F = Toad Raceway

0x80 = Spike Desert
0x81 = GCN Luigi Circuit
0x82 = Unnamed Valley
0x83 = SNES Donut Plains 3
0x84 = GCN Wario Colosseum
0x85 = Dark Matter Shrine
0x86 = Garden of Dreams
0x87 = DS Tick-Tock Clock
0x88 = Neo Koopa City
0x89 = SNES Rainbow Road
0x8A = Cookie Village
0x8B = GCN Sherbet Land
0x8C = Jungle Ruins
0x8D = CTR Cortex Castle
0x8E = Wolf Castlegrounds
0x8F = Glimmer Express Trains

0x90 = Infernal Pipeyard
0x91 = GBA Cheese Land
0x92 = Autumn Leavesway
0x93 = DS Luigi's Mansion
0x94 = Melody Sanctum
0x95 = GBA Sky Garden
0x96 = Nivurbia
0x97 = Cave Island
0x98 = GBA Ribbon Road
0x99 = DS Mario Circuit
0x9A = Wario's Shipwreck
0x9B = Castle of Darkness
0x9C = Desert Castle Raceway
0x9D = Misty Ruins
0x9E = Stargaze Summit
0x9F = Sea Stadium

0xA0 = Calidae Desert
0xA1 = N64 Kalimari Desert
0xA2 = Coin Heaven
0xA3 = Kinoko Cave
0xA4 = GCN Baby Park
0xA5 = Desktop Dash
0xA6 = GBA Bowser Castle 1
0xA7 = Aura Metropolis
0xA8 = CTR Blizzard Bluff
0xA9 = Aquania
0xAA = Abandoned Boardwalk
0xAB = Rezway 2
0xAC = Desert Mushroom Ruins
0xAD = GCN Mushroom City
0xAE = Piranha Plant Pipeline
0xAF = Lava Lake

0xB0 = Wuhu Mountain
0xB1 = Hellado Mountain
0xB2 = Sunset Ridge
0xB3 = N64 Koopa Troopa Beach
0xB4 = Unfinished Mario Circuit
0xB5 = Gothic Castle
0xB6 = Camp Kartigan
0xB7 = Athletic Raceway
0xB8 = GBA Luigi Circuit
0xB9 = GBA Lakeside Park
0xBA = Mushroom Island
0xBB = GBA Mario Circuit
0xBC = Warp Pipe Island
0xBD = DK Ruins
0xBE = Dragon Burial Grounds
0xBF = Dreamworld Cloudway

0xC0 = N64 Frappe Snowland
0xC1 = Suzuka Circuit
0xC2 = DS DK PAss
0xC3 = Volcanic Valley
0xC4 = Underground Sky
0xC5 = Christmas Court
0xC6 = Crystal Plains
0xC7 = Saltwater Lake
0xC8 = Aquadrom Stage
0xC9 = Abyssal Ruins
0xCA = Forest Creek
0xCB = Windmill Village
0xCC = Cherry Blossom Garden
0xCD = Sky Grove
0xCE = Crystal Dungeon
0xCF = Tropical Factory

0xD0 = Sinister Vault
0xD1 = Wetland Woods
0xD2 = Slot Circuit
0xD3 = Dark Matter Fortress
0xD4 = GBA Snow Land
0xD5 = GCN Mushroom Bridge
0xD6 = Secluded Island
0xD7 = Sky High Island
0xD8 = CTR N. Gin Labs
0xD9 = Medieval Castlegrounds
0xDA = Lava Road
0xDB = Boshi Skatepark
0xDC = Jungle Jamble
0xDD = Lunar Spaceway
0xDE = Luigi's Island
0xDF = SNES Bowser Castle 3 2

0xE0 = GP Mario Beach
0xE1 = N64 Wario Stadium
0xE2 = N64 Toad's Turnpike
0xE3 = Icepeak Mountain
0xE4 = Bowser's Fiery Fortress
0xE5 = Windy Whirl
0xE6 = SADX Twinkle Circuit
0xE7 = Fungal Jungle
0xE8 = Seasonal Circuit
0xE9 = GBA Bowser Castle 2
0xEA = Mansion of Madness
0xEB = Cool Castle Canyon
0xEC = SNES Bowser Castle 1
0xED = Sahara Hideout
0xEE = Headlong Skyway
0xEF = Comet Starway

0xF0 = Shadow Woods
0xF1 = Yoshi's Woolly Raceway
0xF2 = SNES Ghost Valley 1
0xF3 = Festival Town
0xF4 = Big Nature City
0xF5 = SNES Koopa Beach 2
0xF6 = White Garden
0xF7 = Dragonite's Island
0xF8 = Jiyuu Village
0xF9 = Rainbow Road: Solar Edition
0xFA = Castle of Time
0xFB = Thwomp Swamp
0xFC = Marble Towers
0xFD = Heart of China
0xFE = Koopa Shell Pipeland

Example file

Here is an example file with the header, cup count, and cup/track blocks highlighted.

It contains 6 cups.

 __ Header (CUP2...)         __ Cup count
|                           |   
[43  55  50  32  00  00  00][06] _
[20  21  22  23][24  25  26  27]  |
[28  29  2A  2B][2C  2D  2E  2F]   > Cups/Tracks
[30  31  32  33][34  35  3B  3C] _|

@liamswill
Copy link

Is there a method for how to derive the track ID from the track?

@1UPNuke
Copy link
Author

1UPNuke commented Jun 18, 2021

@willsigg : Is there a method for how to derive the track ID from the track?

The way I did it is by editing the file to have all the IDs in a file and see what they correspond to in CTGP, I don't think there's a way to know an ID from a track without a pre-existing list

@DrFe4r
Copy link

DrFe4r commented Jul 3, 2021

Can these cuplayout.cup files be made in a simple hex editor?

@1UPNuke
Copy link
Author

1UPNuke commented Jul 3, 2021

@DrFe4r Can these cuplayout.cup files be made in a simple hex editor?

Yes

@liamswill
Copy link

Can these cuplayout.cup files be made in a simple hex editor?

Anything can be made in a hex editor if you try hard enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment