mirror of
https://github.com/pret/pokemon-reverse-engineering-tools.git
synced 2026-09-26 11:29:34 -05:00
remove the Recording junk
That should go into vba_wrapper if it turns out to be important.
This commit is contained in:
@@ -63,59 +63,6 @@ def press(buttons, holdsteps=1, aftersteps=1):
|
||||
for step_counter in range(0, aftersteps):
|
||||
Gb.step(0)
|
||||
|
||||
class Recording:
|
||||
def __init__(self):
|
||||
self.frames = []
|
||||
self.states = {}
|
||||
|
||||
def _get_frame_count(self):
|
||||
return len(self.frames)
|
||||
|
||||
frame_count = property(fget=_get_frame_count)
|
||||
|
||||
def save(self, name=None):
|
||||
"""
|
||||
Saves the current state.
|
||||
"""
|
||||
state = bytearray(get_state())
|
||||
state.name = name
|
||||
self.states[self.frame_count] = state
|
||||
|
||||
def load(self, name):
|
||||
"""
|
||||
Loads a state by name in the state list.
|
||||
"""
|
||||
for state in self.states.items():
|
||||
if state.name == name:
|
||||
set_state(state)
|
||||
return state
|
||||
return False
|
||||
|
||||
def step(self, stepcount=1, first_frame=0, replay=False):
|
||||
"""
|
||||
Records button presses for each frame.
|
||||
"""
|
||||
if replay:
|
||||
stepcount = len(self.frames[first_name:])
|
||||
|
||||
for counter in range(first_frame, stepcount):
|
||||
if replay:
|
||||
press(self.frames[counter], steplimit=0)
|
||||
else:
|
||||
self.frames.append(get_buttons())
|
||||
nstep(1)
|
||||
|
||||
def replay_from(self, thing):
|
||||
"""
|
||||
Replays based on a State or the name of a saved state.
|
||||
"""
|
||||
if isinstance(thing, State):
|
||||
set_state(thing)
|
||||
else:
|
||||
thing = self.load(thing)
|
||||
frame_id = self.states.index(thing)
|
||||
self.step(first_frame=frame_id, replay=True)
|
||||
|
||||
def call(bank, address):
|
||||
"""
|
||||
Jumps into a function at a certain address.
|
||||
|
||||
Reference in New Issue
Block a user