mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-04-02 10:52:54 -04:00
Upcoming Qt will feature native support for multiple controllers + remapping for all relevant OSes. This makes the step a bit easier. Rationale: Windows has cleaner code (becoming just like OnePad) and no more DS4/DualSense/Switch Pro/... wrapper such as steam or DS4Windows (ryochan7) though will still work if you want it. Linux will have OnePad legacy remapping. Mac will have feature parity to some extent.
39 lines
979 B
Python
39 lines
979 B
Python
import os
|
|
|
|
relevant_categories = [
|
|
"# Windows",
|
|
"# Mac OS X",
|
|
"# Linux"
|
|
]
|
|
|
|
header_lines = []
|
|
new_db_contents = []
|
|
|
|
def is_relevant_category(line):
|
|
for category in relevant_categories:
|
|
if category in line:
|
|
return True
|
|
return False
|
|
|
|
with open("./game_controller_db.txt") as file:
|
|
lines = file.readlines()
|
|
finished_header = False
|
|
processing_section = False
|
|
for line in lines:
|
|
if finished_header is False:
|
|
header_lines.append(line)
|
|
if line == "\n":
|
|
finished_header = True
|
|
if processing_section and line == "\n":
|
|
processing_section = False
|
|
new_db_contents.append("\n")
|
|
if is_relevant_category(line) and processing_section is False:
|
|
processing_section = True
|
|
new_db_contents.append(line)
|
|
elif processing_section:
|
|
new_db_contents.append(line)
|
|
|
|
os.remove("./game_controller_db.txt")
|
|
with open("./game_controller_db.txt", "w") as f:
|
|
f.writelines(header_lines)
|
|
f.writelines(new_db_contents)
|