client: accept rom names smaller than 21b

This commit is contained in:
Bonta-kun 2019-12-10 03:01:13 +01:00
parent 0dcb5ba73b
commit 1a60d263ff
1 changed files with 8 additions and 7 deletions

View File

@ -621,12 +621,13 @@ async def process_server_cmd(ctx : Context, cmd, args):
if cmd == 'Connected': if cmd == 'Connected':
ctx.expected_rom = args ctx.expected_rom = args
if ctx.last_rom == ctx.expected_rom: if ctx.last_rom is not None:
rom_confirmed(ctx) if ctx.last_rom[:len(args)] == ctx.expected_rom:
if ctx.locations_checked: rom_confirmed(ctx)
await send_msgs(ctx.socket, [['LocationChecks', [Regions.location_table[loc][0] for loc in ctx.locations_checked]]]) if ctx.locations_checked:
elif ctx.last_rom is not None: await send_msgs(ctx.socket, [['LocationChecks', [Regions.location_table[loc][0] for loc in ctx.locations_checked]]])
raise Exception('Different ROM expected from server') else:
raise Exception('Different ROM expected from server')
if cmd == 'ReceivedItems': if cmd == 'ReceivedItems':
start_index, items = args start_index, items = args
@ -829,7 +830,7 @@ async def game_watcher(ctx : Context):
ctx.last_rom = list(rom) ctx.last_rom = list(rom)
ctx.locations_checked = set() ctx.locations_checked = set()
if ctx.expected_rom is not None: if ctx.expected_rom is not None:
if ctx.last_rom != ctx.expected_rom: if ctx.last_rom[:len(ctx.expected_rom)] != ctx.expected_rom:
print("Wrong ROM detected") print("Wrong ROM detected")
await ctx.snes_socket.close() await ctx.snes_socket.close()
continue continue