How to use the pyboy.logger.logger function in pyboy

To help you get started, we’ve selected a few pyboy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Baekalfen / PyBoy / pyboy / pyboy.py View on Github external
def _unpause(self):
        if not self.paused:
            return
        self.paused = False
        self.target_emulationspeed = self.save_target_emulationspeed
        logger.info("Emulation unpaused!")
        self._update_window_title()
github Baekalfen / PyBoy / pyboy / window / window.py View on Github external
def getwindow(window_type, scale, debug, hide_window):
    logger.info("Window type is: %s" % window_type)

    # Debug mode overwrites any window setting
    if debug:
        from .debug_window import DebugWindow
        window = DebugWindow(scale)
    elif window_type == "SDL2" or window_type is None:
        from .window_sdl2 import SDLWindow
        window = SDLWindow(scale)
    elif window_type == "scanline":
        from .window_scanline import ScanlineWindow
        window = ScanlineWindow(scale)
    elif window_type == "OpenGL":
        from .window_opengl import OpenGLWindow
        window = OpenGLWindow(scale)
    elif window_type == "dummy":
        from .window_dummy import DummyWindow
github Baekalfen / PyBoy / pyboy / pyboy.py View on Github external
def _handle_events(self, events):
        # This feeds events into the tick-loop from the window. There might already be events in the list from the API.
        events = self.plugin_manager.handle_events(events)
        for event in events:
            if event == WindowEvent.QUIT:
                self.done = True
            elif event == WindowEvent.RELEASE_SPEED_UP:
                # Switch between unlimited and 1x real-time emulation speed
                self.target_emulationspeed = int(bool(self.target_emulationspeed) ^ True)
                logger.info("Speed limit: %s" % self.target_emulationspeed)
            elif event == WindowEvent.STATE_SAVE:
                with open(self.gamerom_file + ".state", "wb") as f:
                    self.mb.save_state(IntIOWrapper(f))
            elif event == WindowEvent.STATE_LOAD:
                state_path = self.gamerom_file + ".state"
                if not os.path.isfile(state_path):
                    logger.error(f"State file not found: {state_path}")
                    continue
                with open(state_path, "rb") as f:
                    self.mb.load_state(IntIOWrapper(f))
            elif event == WindowEvent.PASS:
                pass # Used in place of None in Cython, when key isn't mapped to anything
            elif event == WindowEvent.PAUSE_TOGGLE:
                if self.paused:
                    self._unpause()
                else:
github Baekalfen / PyBoy / pyboy / plugins / record_replay.py View on Github external
def __init__(self, *args):
        super().__init__(*args)

        if not self.enabled():
            return

        if not self.pyboy_argv.get("loadstate"):
            logger.warning(
                "To replay input consistently later, it is recommended to load a state at boot. This will be"
                "embedded into the .replay file."
            )

        logger.info("Recording event inputs")
        self.recorded_input = []
github Baekalfen / PyBoy / Source / run_blargg.py View on Github external
def test_rom(rom):
    logger.info(rom)
    pyboy = PyBoy("dummy", 1, rom, "ROMs/DMG_ROM.bin")
    # pyboy = PyBoy("SDL2", 1, rom, "ROMs/DMG_ROM.bin")
    pyboy.disableTitle()
    pyboy.setEmulationSpeed(False)
    serial_output = ""
    t = time.time()
    result = None
    while not pyboy.tick():
        b = pyboy.getSerial()
        if b != "":
            serial_output += b
            # print b,
            t = time.time()

        if "Passed" in serial_output:
            result = ("Passed")