[SM] added support for more than 255 players (will print Archipelago for higher player number) (#130)
* added support for more than 255 players (will print Archipelago for higher player number)
This commit is contained in:
parent
82b8b313f0
commit
452026165f
|
@ -22,6 +22,7 @@ from NetUtils import *
|
|||
from worlds.alttp import Regions, Shops
|
||||
from worlds.alttp import Items
|
||||
from worlds.alttp.Rom import ROM_PLAYER_LIMIT
|
||||
from worlds.sm.Rom import ROM_PLAYER_LIMIT as SM_ROM_PLAYER_LIMIT
|
||||
import Utils
|
||||
from CommonClient import CommonContext, server_loop, console_loop, ClientCommandProcessor, gui_enabled, get_base_parser
|
||||
from Patch import GAME_ALTTP, GAME_SM
|
||||
|
@ -1048,7 +1049,7 @@ async def game_watcher(ctx: Context):
|
|||
item = ctx.items_received[itemOutPtr]
|
||||
itemId = item.item - items_start_id
|
||||
|
||||
playerID = (item.player-1) if item.player != 0 else (len(ctx.player_names)-1)
|
||||
playerID = item.player if item.player <= SM_ROM_PLAYER_LIMIT else 0
|
||||
snes_buffered_write(ctx, SM_RECV_PROGRESS_ADDR + itemOutPtr * 4, bytes([playerID & 0xFF, (playerID >> 8) & 0xFF, itemId & 0xFF, (itemId >> 8) & 0xFF]))
|
||||
itemOutPtr += 1
|
||||
snes_buffered_write(ctx, SM_RECV_PROGRESS_ADDR + 0x602, bytes([itemOutPtr & 0xFF, (itemOutPtr >> 8) & 0xFF]))
|
||||
|
@ -1057,7 +1058,6 @@ async def game_watcher(ctx: Context):
|
|||
ctx.location_name_getter(item.location), itemOutPtr, len(ctx.items_received)))
|
||||
await snes_flush_writes(ctx)
|
||||
|
||||
|
||||
async def run_game(romfile):
|
||||
auto_start = Utils.get_options()["lttp_options"].get("rom_start", True)
|
||||
if auto_start is True:
|
||||
|
|
|
@ -2,6 +2,7 @@ import Utils
|
|||
from Patch import read_rom
|
||||
|
||||
JAP10HASH = '21f3e98df4780ee1c667b84e57d88675'
|
||||
ROM_PLAYER_LIMIT = 255
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
|
@ -27,4 +28,4 @@ def get_base_rom_path(file_name: str = "") -> str:
|
|||
file_name = options["sm_options"]["rom_file"]
|
||||
if not os.path.exists(file_name):
|
||||
file_name = Utils.local_path(file_name)
|
||||
return file_name
|
||||
return file_name
|
||||
|
|
|
@ -11,7 +11,7 @@ from .Items import lookup_name_to_id as items_lookup_name_to_id
|
|||
from .Regions import create_regions
|
||||
from .Rules import set_rules, add_entrance_rule
|
||||
from .Options import sm_options
|
||||
from .Rom import get_base_rom_path
|
||||
from .Rom import get_base_rom_path, ROM_PLAYER_LIMIT
|
||||
import Utils
|
||||
|
||||
from BaseClasses import Region, Entrance, Location, MultiWorld, Item, RegionType, CollectionState
|
||||
|
@ -242,7 +242,7 @@ class SMWorld(World):
|
|||
idx += 1
|
||||
(w0, w1) = self.getWord(0 if itemLoc.item.player == self.player else 1)
|
||||
(w2, w3) = self.getWord(itemId)
|
||||
(w4, w5) = self.getWord(itemLoc.item.player - 1)
|
||||
(w4, w5) = self.getWord(itemLoc.item.player if itemLoc.item.player <= ROM_PLAYER_LIMIT else 0)
|
||||
(w6, w7) = self.getWord(0 if itemLoc.item.advancement else 1)
|
||||
multiWorldLocations[0x1C6000 + locationsDict[itemLoc.name].Id*8] = [w0, w1, w2, w3, w4, w5, w6, w7]
|
||||
|
||||
|
@ -268,9 +268,10 @@ class SMWorld(World):
|
|||
romPatcher.applyIPSPatchDict(patchDict)
|
||||
|
||||
playerNames = {}
|
||||
for p in range(1, self.world.players + 1):
|
||||
playerNames[0x1C5000 + (p - 1) * 16] = self.world.player_name[p][:16].upper().center(16).encode()
|
||||
playerNames[0x1C5000 + (self.world.players) * 16] = "Archipelago".upper().center(16).encode()
|
||||
playerNames[0x1C5000] = "Archipelago".upper().center(16).encode()
|
||||
for p in range(1, min(self.world.players, ROM_PLAYER_LIMIT) + 1):
|
||||
playerNames[0x1C5000 + p * 16] = self.world.player_name[p][:16].upper().center(16).encode()
|
||||
|
||||
|
||||
romPatcher.applyIPSPatch('PlayerName', { 'PlayerName': playerNames })
|
||||
|
||||
|
|
|
@ -573,12 +573,12 @@ class RomPatcher:
|
|||
self.writeCreditsStringBig(address, line, top=False)
|
||||
address += 0x80
|
||||
|
||||
value = " "+settings.progSpeed.upper()
|
||||
value = " "+"NA" # settings.progSpeed.upper()
|
||||
line = " PROGRESSION SPEED ....%s " % value.rjust(8, '.')
|
||||
self.writeCreditsString(address, 0x04, line)
|
||||
address += 0x40
|
||||
|
||||
line = " PROGRESSION DIFFICULTY %s " % settings.progDiff.upper()
|
||||
line = " PROGRESSION DIFFICULTY %s " % value.rjust(7, '.') # settings.progDiff.upper()
|
||||
self.writeCreditsString(address, 0x04, line)
|
||||
address += 0x80 # skip item distrib title
|
||||
|
||||
|
|
Loading…
Reference in New Issue