View difference between Paste ID: 3r65WeGP and 0G1L0vsj
SHOW: | | - or go back to the newest paste.
1
# v2.0
2
def start_config_resetting
3
  
4
  button_data = Cirno::Persistence.default_key_mapping
5
  defined_key = get_defined_keys
6
  for i in 0 ... Cirno::Persistence.keys.size
7
    data = []
8
    key = Cirno::Persistence.keys[i]
9
    
10
    for op in 0 ... Mewgles_SystemOptionsEdit::KEY_COLUMNS
11
      if button_data[key][op] == defined_key[key][op]
12
        data << button_data[key][op]
13
      else
14
        data << defined_key[key][op]
15
      end
16
    end
17
    data = data.compact
18
    Input.set_keys_from_flag(Cirno::Persistence.keys[i], data)
19
  end
20
  Cirno::Persistence.write_keyboard_settings
21
end
22
23
def get_defined_keys
24
  button_data = {}
25
  for flag in Cirno::Persistence.keys
26
    key_data = []
27
    keys = Input.get_keys_from_flag(flag)
28
    for i in 0 ... Mewgles_SystemOptionsEdit::KEY_COLUMNS
29
      if keys[i]
30
        key_data << keys[i]
31
      end
32
    end
33
    button_data[flag] = key_data
34
  end
35
  return button_data
36
end
37
38
start_config_resetting