Exemplo n.º 1
0
    def open(self, stick=0):
        if self.joystick:
            self.close()

        try:
            self.joystick = SDL_JoystickOpen(stick)
        except Exception as err:
            log.warn(str(err))

        if self.joystick:
            self.num_axes = SDL_JoystickNumAxes(self.joystick)
            self.num_buttons = SDL_JoystickNumButtons(self.joystick)
            self.num_hats = SDL_JoystickNumHats(self.joystick)
            self.num_trackballs = SDL_JoystickNumBalls(self.joystick)

            for i in range(self.num_axes):
                self.axes[i] = SDL_JoystickGetAxis(self.joystick, i)
                self.axis_repeat_timers[i] = QTime()
                self.deadzones[i] = self.joystick_deadzone
                self.sensitivities[i] = self.joystick_sensitivity

            for i in range(self.num_buttons):
                self.buttons[i] = SDL_JoystickGetButton(self.joystick, i)
                self.button_repeat_timers[i] = QTime()

            for i in range(self.num_hats):
                self.hats[i] = SDL_JoystickGetHat(self.joystick, i)
                self.hat_repeat_timers[i] = QTime()

            self.clear_events()
            self.joystick_timer.start(self.event_timeout)
            return True
        else:
            log.warn("couldn't open SDL joystick #%d", stick)
            return False
Exemplo n.º 2
0
 def execute(self):
     """Starts the emulator and begin executing the ROM image."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_EXECUTE, 0, None)
     if rval != M64ERR_SUCCESS:
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 3
0
 def delete_section(self, section):
     """Deletes a section from the config."""
     rval = self.m64p.ConfigDeleteSection(C.c_char_p(section.encode()))
     if rval != M64ERR_SUCCESS:
         log.debug("delete_section()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 4
0
 def delete_section(self, section):
     """Deletes a section from the config."""
     rval = self.m64p.ConfigDeleteSection(C.c_char_p(section.encode()))
     if rval != M64ERR_SUCCESS:
         log.debug("delete_section()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 5
0
    def open(self, stick=0):
        if self.joystick:
            self.close()

        try:
            self.joystick = SDL_JoystickOpen(stick)
        except Exception as err:
            log.warn(str(err))

        if self.joystick:
            self.num_axes = SDL_JoystickNumAxes(self.joystick)
            self.num_buttons = SDL_JoystickNumButtons(self.joystick)
            self.num_hats = SDL_JoystickNumHats(self.joystick)
            self.num_trackballs = SDL_JoystickNumBalls(self.joystick)

            for i in range(self.num_axes):
                self.axes[i] = SDL_JoystickGetAxis(self.joystick, i)
                self.axis_repeat_timers[i] = QTime()
                self.deadzones[i] = self.joystick_deadzone
                self.sensitivities[i] = self.joystick_sensitivity

            for i in range(self.num_buttons):
                self.buttons[i] = SDL_JoystickGetButton(self.joystick, i)
                self.button_repeat_timers[i] = QTime()

            for i in range(self.num_hats):
                self.hats[i] = SDL_JoystickGetHat(self.joystick, i)
                self.hat_repeat_timers[i] = QTime()

            self.clear_events()
            self.joystick_timer.start(self.event_timeout)
            return True
        else:
            log.warn("couldn't open SDL joystick #%d", stick)
            return False
Exemplo n.º 6
0
 def read_files(self):
     """Reads files."""
     self.roms = []
     files = self.get_files()
     num_files = len(files)
     for filenum, filename in enumerate(files):
         fullpath = os.path.join(self.rom_path, filename)
         try:
             archive = Archive(fullpath)
             for fname in archive.namelist:
                 rom_header = m64p_rom_header()
                 ctypes.memmove(
                     ctypes.byref(rom_header),
                     archive.read(fname, ctypes.sizeof(rom_header)),
                     ctypes.sizeof(rom_header))
                 rom_settings = self.parent.core.get_rom_settings(
                     sl(rom_header.CRC1), sl(rom_header.CRC2))
                 if rom_settings:
                     crc = "%X%X" % (sl(rom_header.CRC1), sl(
                         rom_header.CRC2))
                     self.roms.append(
                         (crc, rom_settings.goodname, fullpath, fname))
             archive.close()
         except Exception, err:
             log.warn(str(err))
             continue
         percent = float(filenum) / float(num_files) * 100
         self.parent.progressBar.emit(SIGNAL("valueChanged(int)"), percent)
Exemplo n.º 7
0
    def attach_plugins(self, plugins):
        """Attaches plugins to the emulator core."""
        self.plugins = plugins
        for plugin_type in PLUGIN_ORDER:
            plugin = self.plugins[plugin_type]

            if not plugin:
                plugin_map = list(self.plugin_map[plugin_type].values())[0]
            else:
                try:
                    plugin_map = self.plugin_map[plugin_type][plugin]
                except KeyError:
                    continue

            (plugin_handle, plugin_path, plugin_name,
             plugin_desc, plugin_version) = plugin_map

            rval = self.m64p.CoreAttachPlugin(
                C.c_int(plugin_type), C.c_void_p(plugin_handle._handle))
            if rval != M64ERR_SUCCESS:
                log.debug("attach_plugins()")
                log.warn(self.error_message(rval))
                log.warn("core failed to attach %s plugin." % (
                    plugin_name))
            else:
                log.info("using %s plugin: '%s' v%s" % (
                    plugin_name.decode(), plugin_desc, version_split(plugin_version)))
Exemplo n.º 8
0
    def get_parameter(self, param_name):
        """Retrieves the value of one of the emulator's parameters."""
        try:
            param_type = self.parameters[self.section][param_name.encode()]
            param_ctype = M64_CTYPE[param_type]
        except KeyError:
            return
        if param_ctype != C.c_char_p:
            maxsize = C.sizeof(M64_CTYPE[param_type])
            param_value = C.pointer(param_ctype())
        else:
            maxsize = 256
            param_value = C.create_string_buffer(maxsize)

        self.m64p.ConfigGetParameter.argtypes = [
            C.c_void_p, C.c_char_p, C.c_int, C.c_void_p, C.c_int
        ]
        rval = self.m64p.ConfigGetParameter(self.config_handle,
                                            C.c_char_p(param_name.encode()),
                                            C.c_int(param_type), param_value,
                                            C.c_int(maxsize))
        if rval != M64ERR_SUCCESS:
            log.debug("get_parameter()")
            log.warn(self.core.error_message(rval))
            return rval
        else:
            if param_ctype == C.c_char_p:
                return param_value.value
            else:
                return param_value.contents.value
Exemplo n.º 9
0
 def save_file(self):
     """Saves config file to disk."""
     rval = self.m64p.ConfigSaveFile()
     if rval != M64ERR_SUCCESS:
         log.debug("save_file()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 10
0
    def attach_plugins(self, plugins):
        """Attaches plugins to the emulator core."""
        self.plugins = plugins
        for plugin_type in PLUGIN_ORDER:
            plugin = self.plugins[plugin_type]
            if not plugin:
                plugin_maps = list(self.plugin_map[plugin_type].values())
                if not plugin_maps:
                    continue
                plugin_map = plugin_maps[0]
            else:
                plugin_map = self.plugin_map[plugin_type][plugin]
            (plugin_handle, plugin_path, plugin_name, plugin_desc,
             plugin_version) = plugin_map

            rval = self.m64p.CoreAttachPlugin(
                C.c_int(plugin_type), C.c_void_p(plugin_handle._handle))
            if rval != M64ERR_SUCCESS:
                log.debug("attach_plugins()")
                log.warn(self.error_message(rval))
                log.warn("core failed to attach %s plugin." % (plugin_name))
            else:
                log.info("using %s plugin: '%s' v%s" %
                         (plugin_name.decode(), plugin_desc,
                          version_split(plugin_version)))
Exemplo n.º 11
0
 def read_files(self):
     """Reads files."""
     self.roms = []
     files = self.get_files()
     num_files = len(files)
     for filenum, filename in enumerate(files):
         fullpath = os.path.join(self.rom_path, filename)
         try:
             archive = Archive(fullpath)
             for fname in archive.namelist:
                 rom_header = m64p_rom_header()
                 ctypes.memmove(
                     ctypes.byref(rom_header),
                     archive.read(fname, ctypes.sizeof(rom_header)),
                     ctypes.sizeof(rom_header))
                 rom_settings = self.parent.core.get_rom_settings(
                     sl(rom_header.CRC1), sl(rom_header.CRC2))
                 if rom_settings:
                     crc = "%X%X" % (sl(rom_header.CRC1), sl(rom_header.CRC2))
                     self.roms.append((crc, rom_settings.goodname, fullpath, fname))
             archive.close()
         except Exception, err:
             log.warn(str(err))
             continue
         percent = float(filenum) / float(num_files) * 100
         self.parent.progressBar.emit(SIGNAL("valueChanged(int)"), percent)
Exemplo n.º 12
0
 def take_next_screenshot(self):
     """Saves a screenshot at the next possible opportunity."""
     rval = self.m64p.CoreDoCommand(M64CMD_TAKE_NEXT_SCREENSHOT)
     if rval != M64ERR_SUCCESS:
         log.debug("take_next_screenshot()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 13
0
 def reset(self, soft=False):
     """Reset the emulated machine."""
     rval = self.m64p.CoreDoCommand(M64CMD_RESET, C.c_int(int(soft)))
     if rval != M64ERR_SUCCESS:
         log.debug("reset()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 14
0
    def get_parameter(self, param_name):
        """Retrieves the value of one of the emulator's parameters."""
        try:
            param_type = self.parameters[self.section][param_name.encode()]
            param_ctype = M64_CTYPE[param_type]
        except KeyError:
            return
        if param_ctype != C.c_char_p:
            maxsize = C.sizeof(M64_CTYPE[param_type])
            param_value = C.pointer(param_ctype())
        else:
            maxsize = 256
            param_value = C.create_string_buffer(maxsize)

        self.m64p.ConfigGetParameter.argtypes = [
            C.c_void_p, C.c_char_p, C.c_int, C.c_void_p, C.c_int]
        rval = self.m64p.ConfigGetParameter(
            self.config_handle, C.c_char_p(param_name.encode()),
            C.c_int(param_type), param_value, C.c_int(maxsize))
        if rval != M64ERR_SUCCESS:
            log.debug("get_parameter()")
            log.warn(self.core.error_message(rval))
            return rval
        else:
            if param_ctype == C.c_char_p:
                return param_value.value
            else:
                return param_value.contents.value
Exemplo n.º 15
0
 def resume(self):
     """Resumes execution of the emulator if it is paused."""
     rval = self.m64p.CoreDoCommand(M64CMD_RESUME, 0, None)
     if rval != M64ERR_SUCCESS:
         log.debug("resume()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 16
0
    def set_parameter(self, param_name, param_value):
        """Sets the value of one of the emulator's parameters."""
        try:
            param_type = self.parameters[self.section][param_name.encode()]
            param_ctype = M64_CTYPE[param_type]
        except KeyError:
            return

        if param_ctype != C.c_char_p:
            param_value = C.byref(param_ctype(param_value))
            param_arg_type = C.POINTER(param_ctype)
        else:
            param_value = param_ctype(param_value)
            param_arg_type = param_ctype

        self.m64p.ConfigSetParameter.argtypes = [
            C.c_void_p, C.c_char_p, C.c_int, param_arg_type
        ]
        rval = self.m64p.ConfigSetParameter(self.config_handle,
                                            C.c_char_p(param_name.encode()),
                                            C.c_int(param_type), param_value)
        if rval != M64ERR_SUCCESS:
            log.debug("set_parameter()")
            log.warn(self.core.error_message(rval))
        return rval
Exemplo n.º 17
0
 def execute(self):
     """Starts the emulator and begin executing the ROM image."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_EXECUTE, 0, None)
     if rval != M64ERR_SUCCESS:
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 18
0
 def pause(self):
     """Pause the emulator if it is running."""
     rval = self.m64p.CoreDoCommand(M64CMD_PAUSE, 0, None)
     if rval != M64ERR_SUCCESS:
         log.debug("pause()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 19
0
 def stop(self):
     """Stops the emulator, if it is currently running."""
     rval = self.m64p.CoreDoCommand(M64CMD_STOP, 0, None)
     if rval != M64ERR_SUCCESS:
         log.debug("stop()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 20
0
 def save_file(self):
     """Saves config file to disk."""
     rval = self.m64p.ConfigSaveFile()
     if rval != M64ERR_SUCCESS:
         log.debug("save_file()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 21
0
 def state_set_slot(self, slot):
     """Sets the currently selected save slot index."""
     rval = self.m64p.CoreDoCommand(M64CMD_STATE_SET_SLOT, C.c_int(slot))
     if rval != M64ERR_SUCCESS:
         log.debug("state_set_slot()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 22
0
 def send_sdl_keyup(self, key):
     """Injects an SDL_KEYUP event into
     the emulator's core event loop."""
     rval = self.m64p.CoreDoCommand(M64CMD_SEND_SDL_KEYUP, C.c_int(key))
     if rval != M64ERR_SUCCESS:
         log.debug("send_sdl_keyup()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 23
0
 def state_load(self, state_path=None):
     """Loads a saved state file from the current slot."""
     path = C.c_char_p(state_path.encode()) if state_path else None
     rval = self.m64p.CoreDoCommand(M64CMD_STATE_LOAD, C.c_int(1), path)
     if rval != M64ERR_SUCCESS:
         log.debug("state_load()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 24
0
 def save_section(self, section):
     """Saves one section of the current configuration to disk,
     while leaving the other sections unmodified."""
     rval = self.m64p.ConfigSaveSection(C.c_char_p(section.encode()))
     if rval != M64ERR_SUCCESS:
         log.debug("save_section()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 25
0
    def open(self, stick=0):
        if self.joystick:
            self.close()

        try:
            self.joystick = SDL_JoystickOpen(stick)
        except Exception, err:
            log.warn(str(err))
Exemplo n.º 26
0
 def rom_close(self):
     """Closes any currently open ROM."""
     rval = self.m64p.CoreDoCommand(M64CMD_ROM_CLOSE)
     if rval != M64ERR_SUCCESS:
         log.debug("rom_close()")
         log.warn(self.error_message(rval))
         log.error("core failed to close ROM image file.")
     return rval
Exemplo n.º 27
0
 def plugin_shutdown(self, handle, desc):
     """This function destroys data structures and releases
     memory allocated by the plugin library. """
     rval = handle.PluginShutdown()
     if rval != M64ERR_SUCCESS:
         log.debug("plugin_shutdown()")
         log.warn(self.error_message(rval))
         log.warn("%s failed to stop." % desc)
Exemplo n.º 28
0
    def open(self, stick=0):
        if self.joystick:
            self.close()

        try:
            self.joystick = SDL_JoystickOpen(stick)
        except Exception, err:
            log.warn(str(err))
Exemplo n.º 29
0
 def state_set_slot(self, slot):
     """Sets the currently selected save slot index."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_STATE_SET_SLOT, C.c_int(slot))
     if rval != M64ERR_SUCCESS:
         log.debug("state_set_slot()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 30
0
 def take_next_screenshot(self):
     """Saves a screenshot at the next possible opportunity."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_TAKE_NEXT_SCREENSHOT)
     if rval != M64ERR_SUCCESS:
         log.debug("take_next_screenshot()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 31
0
 def pause(self):
     """Pause the emulator if it is running."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_PAUSE, 0, None)
     if rval != M64ERR_SUCCESS:
         log.debug("pause()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 32
0
 def resume(self):
     """Resumes execution of the emulator if it is paused."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_RESUME, 0, None)
     if rval != M64ERR_SUCCESS:
         log.debug("resume()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 33
0
 def gl_get_proc(self, proc):
     """Used to get a pointer to
     an OpenGL extension function."""
     addr = self.glcontext.getProcAddress(proc.decode())
     if addr is not None:
         return addr.__int__()
     else:
         log.warn("VidExtFuncGLGetProc: '%s'" % proc.decode())
Exemplo n.º 34
0
 def stop(self):
     """Stops the emulator, if it is currently running."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_STOP, 0, None)
     if rval != M64ERR_SUCCESS:
         log.debug("stop()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 35
0
 def save_section(self, section):
     """Saves one section of the current configuration to disk,
     while leaving the other sections unmodified."""
     rval = self.m64p.ConfigSaveSection(C.c_char_p(section.encode()))
     if rval != M64ERR_SUCCESS:
         log.debug("save_section()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 36
0
 def plugin_shutdown(self, handle, desc):
     """This function destroys data structures and releases
     memory allocated by the plugin library. """
     rval = handle.PluginShutdown()
     if rval != M64ERR_SUCCESS:
         log.debug("plugin_shutdown()")
         log.warn(self.error_message(rval))
         log.warn("%s failed to stop." % desc)
Exemplo n.º 37
0
 def reset(self, soft=False):
     """Reset the emulated machine."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_RESET, C.c_int(int(soft)))
     if rval != M64ERR_SUCCESS:
         log.debug("reset()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 38
0
 def state_load(self, state_path=None):
     """Loads a saved state file from the current slot."""
     path = C.c_char_p(state_path.encode()) if state_path else None
     rval = self.m64p.CoreDoCommand(
         M64CMD_STATE_LOAD, C.c_int(1), path)
     if rval != M64ERR_SUCCESS:
         log.debug("state_load()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 39
0
 def list_sections(self):
     """Enumerates the list of sections in config file."""
     self.m64p.ConfigListSections.argtypes = [C.c_void_p, C.c_void_p]
     rval = self.m64p.ConfigListSections(
         C.c_void_p(), SECTIONS_FUNC(self.list_sections_callback))
     if rval != M64ERR_SUCCESS:
         log.debug("list_sections()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 40
0
 def send_sdl_keyup(self, key):
     """Injects an SDL_KEYUP event into
     the emulator's core event loop."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_SEND_SDL_KEYUP, C.c_int(key))
     if rval != M64ERR_SUCCESS:
         log.debug("send_sdl_keyup()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 41
0
 def rom_close(self):
     """Closes any currently open ROM."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_ROM_CLOSE)
     if rval != M64ERR_SUCCESS:
         log.debug("rom_close()")
         log.warn(self.error_message(rval))
         log.error("core failed to close ROM image file.")
     return rval
Exemplo n.º 42
0
 def state_save(self, state_path=None, state_type=1):
     """Saves a state file to the current slot."""
     path = C.c_char_p(state_path.encode()) if state_path else None
     rval = self.m64p.CoreDoCommand(M64CMD_STATE_SAVE, C.c_int(state_type),
                                    path)
     if rval != M64ERR_SUCCESS:
         log.debug("state_save()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 43
0
 def advance_frame(self):
     """Advance one frame. The emulator will run
     until the next frame, then pause."""
     rval = self.m64p.CoreDoCommand(M64CMD_ADVANCE_FRAME, C.c_int(),
                                    C.c_int())
     if rval != M64ERR_SUCCESS:
         log.debug("advance_frame()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 44
0
 def plugin_startup(self, handle, name, desc):
     """This function initializes plugin for use by allocating memory,
     creating data structures, and loading the configuration data."""
     rval = handle.PluginStartup(C.c_void_p(self.m64p._handle), name,
                                 DEBUG_CALLBACK)
     if rval != M64ERR_SUCCESS:
         log.debug("plugin_startup()")
         log.warn(self.error_message(rval))
         log.warn("%s failed to start." % desc)
Exemplo n.º 45
0
 def state_save(self, state_path=None, state_type=1):
     """Saves a state file to the current slot."""
     path = C.c_char_p(state_path.encode()) if state_path else None
     rval = self.m64p.CoreDoCommand(
         M64CMD_STATE_SAVE, C.c_int(state_type), path)
     if rval != M64ERR_SUCCESS:
         log.debug("state_save()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 46
0
 def plugin_startup(self, handle, name, desc):
     """This function initializes plugin for use by allocating memory,
     creating data structures, and loading the configuration data."""
     rval = handle.PluginStartup(C.c_void_p(self.m64p._handle),
                                 name, DEBUG_CALLBACK)
     if rval != M64ERR_SUCCESS:
         log.debug("plugin_startup()")
         log.warn(self.error_message(rval))
         log.warn("%s failed to start." % desc)
Exemplo n.º 47
0
 def override_vidext(self):
     """Overrides the core's internal SDL-based OpenGL functions."""
     rval = self.m64p.CoreOverrideVidExt(C.pointer(vidext))
     if rval != M64ERR_SUCCESS:
         log.debug("override_vidext()")
         log.warn(self.error_message(rval))
     else:
         log.info("video extension enabled")
     return rval
Exemplo n.º 48
0
 def revert_changes(self, section):
     """Reverts changes previously made to one section of the current
     configuration file, so that it will match with the configuration
     at the last time that it was loaded from or saved to disk. """
     rval = self.m64p.ConfigRevertChanges(C.c_char_p(section.encode()))
     if rval != M64ERR_SUCCESS:
         log.debug("revert_changes()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 49
0
 def list_sections(self):
     """Enumerates the list of sections in config file."""
     self.m64p.ConfigListSections.argtypes = [C.c_void_p, C.c_void_p]
     rval = self.m64p.ConfigListSections(
         C.c_void_p(), SECTIONS_FUNC(self.list_sections_callback))
     if rval != M64ERR_SUCCESS:
         log.debug("list_sections()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 50
0
 def revert_changes(self, section):
     """Reverts changes previously made to one section of the current
     configuration file, so that it will match with the configuration
     at the last time that it was loaded from or saved to disk. """
     rval = self.m64p.ConfigRevertChanges(C.c_char_p(section.encode()))
     if rval != M64ERR_SUCCESS:
         log.debug("revert_changes()")
         log.warn(self.core.error_message(rval))
     return rval
Exemplo n.º 51
0
 def rom_get_header(self):
     """Retrieves the header data of the currently open ROM."""
     rval = self.m64p.CoreDoCommand(M64CMD_ROM_GET_HEADER,
                                    C.c_int(C.sizeof(self.rom_header)),
                                    C.pointer(self.rom_header))
     if rval != M64ERR_SUCCESS:
         log.debug("rom_get_header()")
         log.warn("core failed to get ROM header.")
     return rval
Exemplo n.º 52
0
 def rom_get_settings(self):
     """Retrieves the settings data of the currently open ROM."""
     rval = self.m64p.CoreDoCommand(M64CMD_ROM_GET_SETTINGS,
                                    C.c_int(C.sizeof(self.rom_settings)),
                                    C.pointer(self.rom_settings))
     if rval != M64ERR_SUCCESS:
         log.debug("rom_get_settings()")
         log.warn("core failed to get ROM settings.")
     return rval
Exemplo n.º 53
0
 def override_vidext(self):
     """Overrides the core's internal SDL-based OpenGL functions."""
     rval = self.m64p.CoreOverrideVidExt(C.pointer(vidext))
     if rval != M64ERR_SUCCESS:
         log.debug("override_vidext()")
         log.warn(self.error_message(rval))
     else:
         log.info("video extension enabled")
     return rval
Exemplo n.º 54
0
 def advance_frame(self):
     """Advance one frame. The emulator will run
     until the next frame, then pause."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_ADVANCE_FRAME, C.c_int(), C.c_int())
     if rval != M64ERR_SUCCESS:
         log.debug("advance_frame()")
         log.warn(self.error_message(rval))
     return rval
Exemplo n.º 55
0
 def core_state_set(self, state, value):
     """Sets the value of a state
     parameter in the emulator core."""
     value_ptr = C.pointer(C.c_int(value))
     rval = self.m64p.CoreDoCommand(
         M64CMD_CORE_STATE_SET, C.c_int(state), value_ptr)
     if rval != M64ERR_SUCCESS:
         log.debug("core_state_set()")
         log.warn(self.error_message(rval))
     return value_ptr.contents.value
Exemplo n.º 56
0
 def rom_get_header(self):
     """Retrieves the header data of the currently open ROM."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_ROM_GET_HEADER,
         C.c_int(C.sizeof(self.rom_header)),
         C.pointer(self.rom_header))
     if rval != M64ERR_SUCCESS:
         log.debug("rom_get_header()")
         log.warn("core failed to get ROM header.")
     return rval
Exemplo n.º 57
0
 def rom_get_settings(self):
     """Retrieves the settings data of the currently open ROM."""
     rval = self.m64p.CoreDoCommand(
         M64CMD_ROM_GET_SETTINGS,
         C.c_int(C.sizeof(self.rom_settings)),
         C.pointer(self.rom_settings))
     if rval != M64ERR_SUCCESS:
         log.debug("rom_get_settings()")
         log.warn("core failed to get ROM settings.")
     return rval
Exemplo n.º 58
0
 def core_state_set(self, state, value):
     """Sets the value of a state
     parameter in the emulator core."""
     value_ptr = C.pointer(C.c_int(value))
     rval = self.m64p.CoreDoCommand(M64CMD_CORE_STATE_SET, C.c_int(state),
                                    value_ptr)
     if rval != M64ERR_SUCCESS:
         log.debug("core_state_set()")
         log.warn(self.error_message(rval))
     return value_ptr.contents.value
Exemplo n.º 59
0
 def core_state_query(self, state):
     """Query the emulator core for the
     value of a state parameter."""
     state_ptr = C.pointer(C.c_int())
     rval = self.m64p.CoreDoCommand(
         M64CMD_CORE_STATE_QUERY, C.c_int(state), state_ptr)
     if rval != M64ERR_SUCCESS:
         log.debug("core_state_query()")
         log.warn(self.error_message(rval))
     return state_ptr.contents.value