def __init__(
        self, platform_name: str, app_type: type[ManuallySpecifiedGameType],
        launcher_type: type[ManuallySpecifiedLauncher],
        emulators_dict: Mapping[str, 'Emulator[ManuallySpecifiedGameType]']
    ) -> None:
        self.platform = manually_specified_platforms[
            platform_name]  #TODO: Might not always be a thing
        self._app_type = app_type
        self._launcher_type = launcher_type
        platform_config = platform_configs.get(platform_name)
        if not platform_config:
            self._is_available = False
            return
        super().__init__(platform_config, self.platform, emulators_dict)

        self._app_list_path = config_dir.joinpath(self.platform.json_name +
                                                  '.json')
        self._app_list: Optional[Sequence[Mapping[str, Any]]] = None
        try:
            self._is_available = bool(platform_config.chosen_emulators)
            with self._app_list_path.open('rt', encoding='utf-8') as f:
                self._app_list = json.load(f)
        except json.JSONDecodeError as json_fuckin_bloody_error:
            print(self._app_list_path, 'is borked, skipping', platform_name,
                  json_fuckin_bloody_error)
            self._is_available = False
        except FileNotFoundError:
            self._is_available = False
Ejemplo n.º 2
0
	def _process_inbuilt_game(self, machine_name: str, inbuilt_game: InbuiltGame, bios_name=None) -> Optional[MAMEInbuiltLauncher]:
		if not default_mame_executable.verifyroms(machine_name):
			return None

		#Actually, this probably doesn't matter at all… but eh, just feels more correct than simply passing blank_platform_config to satisfy EmulatedGame constructor
		platform_config = platform_configs.get(inbuilt_game.platform, self.blank_platform_config)
			
		#MachineNotFoundException shouldn't happen because verifyroms already returned true? Probably
		machine = get_machine(machine_name, default_mame_executable)
		
		game = MAMEInbuiltGame(machine_name, inbuilt_game, platform_config, bios_name)
		add_status(machine, game.metadata)
		return MAMEInbuiltLauncher(game, ConfiguredMAME(emulator_configs.get('MAME')))
Ejemplo n.º 3
0
    MAMENotInstalledException
from meowlauncher.games.mame_common.mame_helpers import default_mame_executable
from meowlauncher.games.mame_common.software_list_find_utils import (
    find_in_software_lists_with_custom_matcher, get_crc32_for_software_list)
from meowlauncher.games.roms.rom import FileROM
from meowlauncher.metadata import Date, Metadata
from meowlauncher.platform_types import NESPeripheral
from meowlauncher.util.region_info import TVSystem
from meowlauncher.util.utils import decode_bcd, load_dict

if TYPE_CHECKING:
	from meowlauncher.games.mame_common.software_list import (Software,
	                                                          SoftwarePart)
	from meowlauncher.games.roms.rom_game import ROMGame

_nes_config = platform_configs.get('NES')
_nintendo_licensee_codes = load_dict(None, 'nintendo_licensee_codes')

_standard_controller = input_metadata.NormalController()
_standard_controller.dpads = 1
_standard_controller.face_buttons = 2 #A B

_ines_mappers = {
	#TODO: This should be a dataclass, instead of storing both Mapper (name) and Mapper Number in the game info
	#6, 8, 17 are some kind of copier thing
	#29 is for homebrew but doesn't really have a name
	#31 is for homebrew musicdisks specifically
	#51, 53, 55, 126, 162, 197, 204, 213, 214, 217, 236, 244, 251 are unknown/undocumented pirate mappers
	#63, 103, 108, 117, 120, 170, 179, 216 are even more unknown
	#160 is unknown (well, undocumented) Sachen mapper; 56, 142, 175 are undocumented Kaiser mappers; 198, 223, 249 are undocumented Waixing mappers
	#98, 102, 109, 110, 122, 124, 127, 128, 129, 130, 131, 161, 239, 247 are unassigned supposedly (I bet someone's assigned them by now)
Ejemplo n.º 4
0
import os
from collections.abc import Mapping
from pathlib import Path, PurePath
from typing import TYPE_CHECKING, Any

from meowlauncher.config.platform_config import platform_configs
from meowlauncher.games.common.pc_common_metadata import look_for_icon_for_file
from meowlauncher.manually_specified_game import ManuallySpecifiedGame

if TYPE_CHECKING:
    from meowlauncher.config_types import PlatformConfig

dos_config = platform_configs.get('DOS')


class DOSApp(ManuallySpecifiedGame):
    def __init__(self, info: Mapping[str, Any],
                 platform_config: 'PlatformConfig'):
        super().__init__(info, platform_config)
        if self.is_on_cd:
            self.path = self.path.replace('/', '\\')

    @property
    def is_valid(self) -> bool:
        if self.is_on_cd:
            if not self.cd_path:
                return False
            return self.cd_path.is_file(
            )  #TODO: Use pycdlib to see if it exists on the CD
        return os.path.isfile(self.path)
Ejemplo n.º 5
0
                                     convert_alphanumeric, load_dict)

from .common.gamecube_wii_common import (NintendoDiscRegion,
                                         add_gamecube_wii_disc_metadata,
                                         just_read_the_wia_rvz_header_for_now,
                                         _tdb)
from .common.gametdb import add_info_from_tdb
from .common.nintendo_common import parse_ratings

if TYPE_CHECKING:
	from meowlauncher.games.roms.rom_game import ROMGame
	from meowlauncher.metadata import Metadata

_nintendo_licensee_codes = load_dict(None, 'nintendo_licensee_codes')

_wii_config = platform_configs.get('Wii')

class WiiVirtualConsolePlatform(Enum):
	Commodore64 = 'C'
	Arcade = 'E' #Includes Neo Geo
	NES = 'F' #F for Famicom presumably
	SNES = 'J'
	MasterSystem = 'L'
	MegaDrive = 'M'
	N64 = 'N'
	PCEngine = 'P'
	PCEngineCD = 'Q'
	MSX = 'X' #Baaaaahhhh this is also used for WiiWare demos and how are we gonna differentiate that

def _round_up_to_multiple(num: int, factor: int) -> int:
	return num + (factor - (num % factor)) % factor
Ejemplo n.º 6
0
from meowlauncher.common_types import SaveType
from meowlauncher.config.main_config import main_config
from meowlauncher.config.platform_config import platform_configs
from meowlauncher.games.mame_common.software_list_find_utils import (
    find_in_software_lists, matcher_args_for_bytes)
from meowlauncher.games.roms.rom import FileROM
from meowlauncher.platform_types import GameBoyColourFlag
from meowlauncher.util.utils import (NotAlphanumericException,
                                     convert_alphanumeric, load_dict)

if TYPE_CHECKING:
	from meowlauncher.games.mame_common.software_list import Software
	from meowlauncher.games.roms.rom_game import ROMGame
	from meowlauncher.metadata import Metadata

_game_boy_config = platform_configs.get('Game Boy')
_nintendo_licensee_codes = load_dict(None, 'nintendo_licensee_codes')

@dataclass(frozen=True)
class GameBoyMapper():
	name: str
	has_ram: bool = False
	has_battery: bool = False
	has_rtc: bool = False
	has_rumble: bool = False
	has_accelerometer: bool = False
	
game_boy_mappers = {
	0: GameBoyMapper("ROM only"),
	8: GameBoyMapper("ROM only", has_ram=True),
	9: GameBoyMapper("ROM only", has_ram=True, has_battery=True),