# -*- coding: utf-8 -*- with open('poker.asm', 'r', encoding='cp1251') as f: text = f.read() target_str = 'pokerTitle db 13,10,"--- Poker ---",13,10,0\n' new_str = target_str + '''pokerModeMenuText db "1. Классический покер 1 на 1 (против Дилера)",13,10 db "2. Стол на 4 персоны (Вы против посетителей казино)",13,10 db "0. Выход в главное меню",13,10 db "Выбор: ",0 ''' target_proc = 'GamePoker PROC\nstart_poker:\n' new_proc = '''GamePoker PROC poker_choose_mode: call ClearView invoke PrintTitleColor, OFFSET pokerTitle invoke PrintStr, OFFSET pokerModeMenuText call ReadKey cmp al, '1' je start_poker cmp al, '2' je poker_launch_multitable cmp al, '0' je poker_mode_exit jmp poker_choose_mode poker_launch_multitable: call GameMultiPoker ret poker_mode_exit: ret start_poker: ''' if target_str not in text: print("ERROR: target_str not found") elif target_proc not in text: print("ERROR: target_proc not found") else: text = text.replace(target_str, new_str, 1) text = text.replace(target_proc, new_proc, 1) with open('poker.asm', 'w', encoding='cp1251') as f: f.write(text) print("poker.asm patched successfully")