How to use the gilgamesh.snes.rom.ROMType function in gilgamesh

To help you get started, we’ve selected a few gilgamesh 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 AndreaOrru / gilgamesh / tests / test_rom.py View on Github external
def test_type(self):
        self.assertEqual(self.rom.type, ROMType.LoROM)
github AndreaOrru / gilgamesh / tests / test_rom.py View on Github external
def test_type(self):
        self.assertEqual(self.rom.type, ROMType.HiROM)
github AndreaOrru / gilgamesh / gilgamesh / snes / rom.py View on Github external
def _discover_subtype(self) -> ROMType:
        markup = self.read_byte(Header.MARKUP)
        if (self.type == ROMType.LoROM) and (markup & 0b10):
            return ROMType.ExLoROM
        elif (self.type == ROMType.HiROM) and (markup & 0b100):
            return ROMType.ExHiROM
        return self.type
github AndreaOrru / gilgamesh / gilgamesh / snes / rom.py View on Github external
def _translate(self, address: int) -> int:
        # Translate address from SNES to PC format.
        if self.type == ROMType.LoROM:
            pc = ((address & 0x7F0000) >> 1) | (address & 0x7FFF)

        elif self.type == ROMType.ExLoROM:
            if address & 0x800000:
                pc = ((address & 0x7F0000) >> 1) | (address & 0x7FFF)
            else:
                pc = (((address & 0x7F0000) >> 1) | (address & 0x7FFF)) + 0x400000

        elif self.type == ROMType.HiROM:
            pc = address & 0x3FFFFF

        elif self.type == ROMType.ExHiROM:
            if (address & 0xC00000) != 0xC00000:
                pc = (address & 0x3FFFFF) | 0x400000
            else:
                pc = address & 0x3FFFFF
github AndreaOrru / gilgamesh / gilgamesh / snes / rom.py View on Github external
def _discover_subtype(self) -> ROMType:
        markup = self.read_byte(Header.MARKUP)
        if (self.type == ROMType.LoROM) and (markup & 0b10):
            return ROMType.ExLoROM
        elif (self.type == ROMType.HiROM) and (markup & 0b100):
            return ROMType.ExHiROM
        return self.type
github AndreaOrru / gilgamesh / gilgamesh / snes / rom.py View on Github external
def _discover_type(self) -> ROMType:
        if len(self.data) <= 0x8000:
            return ROMType.LoROM
        lorom_score = self._type_score(ROMType.LoROM)
        hirom_score = self._type_score(ROMType.HiROM)
        if hirom_score > lorom_score:
            return ROMType.HiROM
        else:
            return ROMType.LoROM