Key flags for Carbon and Cocoa

A rather difficult question.

I use CarbonHotkeyMBS for detecting global keys pressed by the user.
To set the hotkeys flags I use the following Carbon flag codes:
const activeFlag = 1
const btnState = 128
const cmdKey = 256
const shiftKey = 512
const alphaLock = 1024
const optionKey = 2048
const controlKey = 4096
const rightShiftKey = 8192
const rightOptionKey = 16384
const rightControlKey = 32768

For the NSShortkeyrecorder you need to have the Cocoa key flags which are different from Carbon (for example shift key = 131072, cmdkey = 1048576 , …)

Is there some way to convert a Carbon key flag to Cocoa key flags?

I googled on “NSShortkeyRecorder” and only get your question (above).

https://github.com/Kentzo/ShortcutRecorder

dtPlugins has this.