diff --git a/docs/index.html b/docs/index.html index 5870ae750..e772a6ee7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1314,7 +1314,34 @@

Kwargs

`pyboy.api.tile.Tile`: A Tile object for the given identifier. """ - return Tile(self.mb, identifier=identifier) + return Tile(self.mb, identifier=identifier) + + def rtc_lock_experimental(self, enable): + """ + **WARN: This is an experimental API and is subject to change.** + + Lock the Real Time Clock (RTC) of a supporting cartridge. It might be advantageous to lock the RTC when training + an AI in games that use it to change behavior (i.e. day and night). + + The first time the game is turned on, an `.rtc` file is created with the current time. This is the epoch for the + RTC. When using `rtc_lock_experimental`, the RTC will always report this point in time. If you let the game progress first, + before using `rtc_lock_experimental`, the internal clock will move backwards and might corrupt the game. + + Example: + ```python + >>> pyboy = PyBoy('game_rom.gb') + >>> pyboy.rtc_lock_experimental(True) # RTC will not progress + ``` + + **WARN: This is an experimental API and is subject to change.** + + Args: + enable (float): Point in time to lock RTC to + """ + if self.mb.cartridge.rtc_enabled: + self.mb.cartridge.rtc.timelock = enable + else: + raise Exception("There's no RTC for this cartridge type")

Instance variables

@@ -2739,6 +2766,58 @@

Returns

return Tile(self.mb, identifier=identifier) +
+def rtc_lock_experimental(self, enable) +
+
+

WARN: This is an experimental API and is subject to change.

+

Lock the Real Time Clock (RTC) of a supporting cartridge. It might be advantageous to lock the RTC when training +an AI in games that use it to change behavior (i.e. day and night).

+

The first time the game is turned on, an .rtc file is created with the current time. This is the epoch for the +RTC. When using rtc_lock_experimental, the RTC will always report this point in time. If you let the game progress first, +before using rtc_lock_experimental, the internal clock will move backwards and might corrupt the game.

+

Example:

+
>>> pyboy = PyBoy('game_rom.gb')
+>>> pyboy.rtc_lock_experimental(True) # RTC will not progress
+
+

WARN: This is an experimental API and is subject to change.

+

Args

+
+
enable : float
+
Point in time to lock RTC to
+
+
+ +Expand source code + +
def rtc_lock_experimental(self, enable):
+    """
+    **WARN: This is an experimental API and is subject to change.**
+
+    Lock the Real Time Clock (RTC) of a supporting cartridge. It might be advantageous to lock the RTC when training
+    an AI in games that use it to change behavior (i.e. day and night).
+
+    The first time the game is turned on, an `.rtc` file is created with the current time. This is the epoch for the
+    RTC. When using `rtc_lock_experimental`, the RTC will always report this point in time. If you let the game progress first,
+    before using `rtc_lock_experimental`, the internal clock will move backwards and might corrupt the game.
+
+    Example:
+    ```python
+    >>> pyboy = PyBoy('game_rom.gb')
+    >>> pyboy.rtc_lock_experimental(True) # RTC will not progress
+    ```
+
+    **WARN: This is an experimental API and is subject to change.**
+
+    Args:
+        enable (float): Point in time to lock RTC to
+    """
+    if self.mb.cartridge.rtc_enabled:
+        self.mb.cartridge.rtc.timelock = enable
+    else:
+        raise Exception("There's no RTC for this cartridge type")
+
+
@@ -3251,6 +3330,7 @@

PyBoy

  • get_sprite
  • get_sprite_by_tile_identifier
  • get_tile
  • +
  • rtc_lock_experimental
  • screen
  • memory
  • memory_scanner