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
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
def rom_open(self, romfile): """Reads in a binary ROM image""" self.rom_length = len(romfile) self.rom_type = ROM_TYPE[binascii.hexlify(romfile[:4])] romlength = C.c_int(self.rom_length) rombuffer = C.c_buffer(romfile) rval = self.m64p.CoreDoCommand( M64CMD_ROM_OPEN, romlength, C.byref(rombuffer)) if rval != M64ERR_SUCCESS: log.debug("rom_open()") log.warn(self.error_message(rval)) log.error("core failed to open ROM file.") del rombuffer return rval
def plugin_load_try(self, plugin_path=None): """Loads plugins and maps them by plugin type.""" try: plugin_handle = C.cdll.LoadLibrary(plugin_path) version = self.plugin_get_version(plugin_handle, plugin_path) if version: plugin_type, plugin_version, plugin_api, plugin_desc, plugin_cap = version plugin_name = os.path.basename(plugin_path) self.plugin_map[plugin_type][plugin_name] = ( plugin_handle, plugin_path, PLUGIN_NAME[plugin_type], plugin_desc, plugin_version) except OSError as e: log.debug("plugin_load_try()") plugin_path = plugin_path.encode('ascii').decode('ascii', 'ignore') log.error("failed to load plugin %s: %s" % (plugin_path, e))
def rom_open(self, romfile): """Reads in a binary ROM image""" self.rom_length = len(romfile) self.rom_type = ROM_TYPE[binascii.hexlify(romfile[:4])] romlength = C.c_int(self.rom_length) rombuffer = C.c_buffer(romfile) rval = self.m64p.CoreDoCommand(M64CMD_ROM_OPEN, romlength, C.byref(rombuffer)) if rval != M64ERR_SUCCESS: log.debug("rom_open()") log.warn(self.error_message(rval)) log.error("core failed to open ROM file.") del rombuffer return rval
def plugin_load_try(self, plugin_path=None): """Loads plugins and maps them by plugin type.""" try: plugin_handle = C.cdll.LoadLibrary(plugin_path) version = self.plugin_get_version(plugin_handle, plugin_path) if version: plugin_type, plugin_version, plugin_api, plugin_desc, plugin_cap = version plugin_name = os.path.basename(plugin_path) self.plugin_map[plugin_type][plugin_name] = ( plugin_handle, plugin_path, PLUGIN_NAME[plugin_type], plugin_desc, plugin_version) except OSError as e: log.debug("plugin_load_try()") plugin_path = plugin_path.decode('ascii', 'ignore') plugin_path = plugin_path.encode('ascii') log.error("failed to load plugin %s: %s" % (plugin_path, e))