mirror of
https://github.com/Lorenzooone/PokemonGB_Online_Trades.git
synced 2026-03-21 18:04:50 -05:00
Add proper RNG send to console
This commit is contained in:
parent
65e08438b6
commit
dcf9fb2b32
|
|
@ -450,6 +450,7 @@ class GSCTrading:
|
|||
max_tolerance_bytes = 3
|
||||
special_sections_len = [0xA, 0x1BC, 0xC5, 0x181]
|
||||
special_sections_starter = [next_section, next_section, next_section, mail_next_section]
|
||||
special_sections_preamble_len = [7, 6, 3, 5]
|
||||
special_sections_sync = [True, True, True, False]
|
||||
drop_bytes_checks = [[0xA, 0x1B9, 0xC5, 0x181], [next_section, next_section, mail_next_section, no_input], [0,0,0,0]]
|
||||
stop_trade = 0x7F
|
||||
|
|
@ -596,11 +597,21 @@ class GSCTrading:
|
|||
if self.special_sections_sync[index]:
|
||||
next = self.no_input
|
||||
# Make sure the device is in the right state
|
||||
while next != self.special_sections_starter[index]:
|
||||
next = self.swap_byte(next)
|
||||
# Sync with the device and start the actual trade
|
||||
while next == self.special_sections_starter[index]:
|
||||
next = self.swap_byte(next)
|
||||
recv = next
|
||||
while recv != self.special_sections_starter[index]:
|
||||
recv = self.swap_byte(next)
|
||||
next = self.special_sections_starter[index]
|
||||
# Random has no leeway, though it's not needed, since master sets the RNG
|
||||
if buffered and (index == 0):
|
||||
# The "+ 1" is because the first one is not counted...
|
||||
for i in range(self.special_sections_preamble_len[index] + 1):
|
||||
next = self.swap_byte(next)
|
||||
if next != self.special_sections_starter[index]:
|
||||
break
|
||||
else:
|
||||
# Sync with the device and start the actual trade
|
||||
while next == self.special_sections_starter[index]:
|
||||
next = self.swap_byte(next)
|
||||
# next now contains the first received byte from the device!
|
||||
|
||||
self.verbose_print(GSCTradingStrings.separate_section_str, end='')
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ class RBYTrading(GSCTrading):
|
|||
enter_room_states = [[0x01, 0x60, 0xD0, 0xD4], [{0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x6F}, {0xD0, 0xD1, 0xD2, 0xD3, 0xD4}, {0xD0, 0xD1, 0xD2, 0xD3, 0xD4}, {0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x6F}]]
|
||||
start_trading_states = [[0x60, 0x60], [{0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x6F}, {0xFD}]]
|
||||
special_sections_len = [0xA, 0x1A2, 0xC5]
|
||||
special_sections_preamble_len = [7, 6, 3]
|
||||
success_base_value = 0x60
|
||||
success_values = set(range(success_base_value, success_base_value+0x10))
|
||||
possible_indexes = set(range(0x60, 0x70))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user