Skip to content

Instantly share code, notes, and snippets.

@madewokherd
Last active October 2, 2017 04:08
Show Gist options
  • Save madewokherd/e9152cdfbc651f918fab3722bb8d7d7c to your computer and use it in GitHub Desktop.
Save madewokherd/e9152cdfbc651f918fab3722bb8d7d7c to your computer and use it in GitHub Desktop.
Gargoyle's Quest 2 (GB) password generation
#!/usr/bin/env python
jump_level = 4 # FFD4: 0-4
health_level = 4 # FFE0: 0-4
wing_level = 4 # FFD8: 0-4
magic_types = 4 # FFD2: 0-4 ?
# 0 = fire
# 1 = buster
# 2 = tornado
# 3 = claw
# 4 = dark fire
scene = 10 # FFC8
# 1 = warrior's training center portal
# 2 = fighting through etruria, black light
# 3 = cave to sittem
# 4 = sand frog castle
# 5 = pass to imaus
# 6 = labyrinth
# 7 = Goza Castle
# 8 = Breager Castle
# 9 = Goza
# 10 = Breager
# 11 = first bridge
# 12 = river of flames
# 13 = gaza valley
# 14 = bridge to king's palace
# 15 = achelon's water
# 16 = pass to labyrinth
# 17 = forced encounter
# 18 = Nagus
# 19 = Naga's Path
# 21 = Death Balloon
# 22 = Dagon
# 23 = Sand Frog
# 24 = Twin Guardians
# 25 = Mantis fight
# 26 = Fake King
# 27 = pass to labyrinth, reverse
# 29 = cave to sittem, reverse
# 30 = river of flames, reverse
# 38 = Doppelganger
# 39 = encounter east of Sidon
# 40 = encounter
# 41 = encounter east of king's palace
# 42 = checkpoint in forest
# 43 = checkpoint in pass to imaus
# 44 = ice cave
# 46 = garbage
# 47 = garbage
# 48 = exiting starting town
# 49 = starting town
# 51 = sidon
# 52 = loosekeep
# 53 = king's palace
# 54 = topete
# 55 = cave containing majorita's home
# 56 = talking to king
# 57 = jark throne room
# 58 = Goza throne room
# 59 = talking to demagorgon
# 60 = buy maelstrom in etruria
# 61 = building in etruria
# 62 = warrior's training center
# 63 = building in etruria
# 64 = majorita's home
# 65 = labyrinth entrance
# 66 = exiting building in jark's town
# 67 = defeated twin guardians
# 68 = warrior's training center, black light
# 69 = warrior's training center, after nagus
# 70 = starting town, exiting warrior's training center
# 71 = starting town, exiting nagus fight
# 72 = etruria throne room, after nagus
# 73 = exiting warrior training center, after nagus
# 74 = etruria throne room, before nagus
# 75 = exiting building in etruria
# 76 = exiting building in etruria
# 77 = exiting building in etruria
# 78 = buying maelstrom in etruria, after nagus
# 86 = exiting first bridge north
# 106 = exiting death balloon
# 108 = exiting majorita's home
# 112 = exiting gaza valley towards desert
# 115 = intro story dump
# 116 = exiting forced encounter
# 118 = exiting bridge towards king's palace
# 121 = laboritory in king's palace
# 128 = exiting laboritory in king's palace
# 156 - breager throne room
# 157 - defeated breager
# 158 - final scene
# 159 = got achelon's water
# 160 = standing in front of mantis as if an encounter finished?
# 161 = defeated fake king
# 162 = rushifell tower
# 163 = verona tower
# 166 = exiting rushifell tower
# 182 - credits
# 186 = got astral projection
# 192 = automatic checkpoint from before argob's pot
# 197 - automatic checkpoint before breager's castle
# 220-254 = crash
# 255 - boss list
unk_FFE4 = 0xff
# 0x1 = have ARGOB'S POT
# 0x2 = have NIGHT DROP
# 0x4 = have CANDLE OF DARKNESS
# 0x8 = have GREMLIN STICK
# 0x10 = have ACHELON'S WATER
# 0x20 = have DAGON'S SCALES
# 0x40 = have CANDLE OF POLTERGEIST
# 0x80 = have LETHE'S CANDLE
unk_FFE5 = 0xff
# 0x1 = have angel wings
# 0x2 = have hippogriff's feather
# 0x4 = have bereal's wings
# 0x8 = have spectre's fingernail
# 0x10 = have mammon's hoof
# 0x20 = have dragon's armor
# 0x40 = have atlas's armor
# 0x80 = have essence of soulstream
unk_FFE6 = 0xf
# 0x1 = have candle of the ghoul realm
# 0x2 = have homing fire
# 0x4 = have astral projection
# 0x8 = have life upgrade from laboritory
unk_FFDB = 23 # point in story
# 0 = starting
# 1 = got argob's pot
# 2 = got spectre's fingernail
# 3 = showed fingernail to NPC
# 4 = won forced overworld fight
# 5 = got dragon's armor
# 6 = defeated death balloon
# 7 = showed night drop to majorita
# 8 = used candle of darkness
# 9 = got wings from majorita
# 10 = showed wings to NPC
# 11 = defeated sand frog
# 12 = used gremlin stick (impossible to actually get in this state, and it's a soft lock)
# 13 = really used gremlin stick
# 14 = talked to NPC on the way to king's palace
# 15 = defeated fake king
# 16 = defeated enemy blocking labyrinth
# 17 = defeated doppelganger
# 18 = talked to rushifell only
# 19 = talked to verona only
# 20 = talked to both (rushifell first)
# 21 = talked to both (verona first)
# 22 = got candle of the ghoul realm
# 23 = used candle of the ghoul realm
def generate(): #467D
data = [0] * 6
DE = magic_types * 125 + wing_level * 25 + health_level * 5 + jump_level
data[0] = DE & 0xff
data[1] = scene
data[2] = unk_FFE4
data[3] = unk_FFE5
data[4] = unk_FFDB | ((DE >> 2) & 192)
data[5] = (unk_FFE6 & 0xf) << 4
check = nibble_parity(data)
data[5] = ((~check) & 0xf) | data[5]
return "%08u-%08u" % ((data[2] | (data[1] << 8) | (data[0] << 16)),
(data[5] | (data[4] << 8) | (data[3] << 16)))
def nibble_parity(data): #4796
result = 0
for i in data:
result = result ^ (i & 0xf) ^ ((i & 0xf0) >> 4)
return result
if __name__ == '__main__':
print generate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment