From SlyMods
(Redirected from LOCKG)
Jump to navigation Jump to search
Data Structure
GameSly Cooper and the Thievius Raccoonus
Official NameYes

LOCKG (internal name LOCK_GROUP) is a data structure in Sly Cooper and the Thievius Raccoonus that handles interaction between Sly and treasure key locks.


The LOCKG struct has the following fields:

Offset Size Type Name Description
grfws Bitfield OR'd with the grfws on the global GS struct when triggered
struct SMA*
psma The SMA activated when triggered
struct SM*
psm Unknown SM pointer
coidLock Count of lock OIDs
enum OID[8]
aoidLock Array of lock OIDs
cplock Count of locks in the group
aplock Array of lock pointers


When the trigger volume associated with a LOCKG is triggered it sets off a sequence of events. It starts with the animation that spawns a KEY for each Sly 1:LOCK in the aplock array. Each key flies to its assigned lock and then despawns.

At some point a message with ID 0xXXX[check] is sent to the JT struct. This message is processed by HandleJtMessage, which checks if the ckey on the current world state is greater than the cppock[check] on the LOCKG (i.e. it checks if you have enough keys to open the lock).

If the check passes, it uses the LOCKG->FWS as a bitmask to set the corresponding flag on the FWS of the current WS. It then unlocks the locks and sets the SMA based on the LOCKG-> sma pointer. The SMA is processed by Splice to trigger whatever scripted event happens as a result of the locks being unlocked.

Once all locks complete their unlock animation, the associated locks disappear from the world.


In Prowling the Grounds, the LOCKG which handles unlocking the cannon is based at address 0xXXXXXX[check]. It’s cplock[check] value is 7, meaning there are 7 locks in the aplock array, so when you approach the cannon it checks if you have 7 keys.

If the check fails, nothing happens. If the check passes, it sets the SMA goal to 0xXXXXXX[check], which seems to handle removing the lid from the cannon.


  • The aplock field is an array of 8 LOCK pointers. You can change these to point to any other entity in the level and they key will fly to and delete that entity instead. If you use this method to delete JT, the cutscene can’t complete and the game softlocks.