Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

import os 

from lutris.runners.runner import Runner 

 

 

class sdlmess(Runner): 

    executable = 'mess' 

    platform = 'multi-platform' 

    game_options = [ 

        { 

            'option': 'main_file', 

            'type': 'file', 

            'label': 'Rom file' 

        }, 

        { 

            'option': 'machine', 

            'type': 'choice', 

            'label': "Machine", 

            'choices': [ 

                ("Amstrad CPC 464", 'cpc464'), 

                ("Amstrad CPC 6128", 'cpc6128'), 

                ("Commodore 64", 'c64'), 

                ("ZX Spectrum", 'spectrum'), 

                ("ZX Spectrum 128", 'spec128'), 

            ] 

        }, 

        { 

            'option': 'device', 

            'type': 'choice', 

            'label': "Storage type", 

            'choices': [ 

                ("Floppy disk", 'flop1'), 

                ("Cassette", 'cass'), 

                ("Cartridge", 'cart'), 

                ("Snapshot", 'snapshot'), 

                ("Quickload", 'quickload'), 

            ] 

        } 

    ] 

    runner_options = [ 

        { 

            'option': 'rompath', 

            'type': 'directory_chooser', 

            'label': "BIOS path" 

        } 

    ] 

 

    def play(self): 

        rompath = self.settings['sdlmess'].get('rompath') 

        if not os.path.exists(rompath): 

            return {'error': 'FILE_NOT_FOUND', 'file': rompath} 

        machine = self.settings['game'].get('machine') 

        if not machine: 

            return {'error': 'INCOMPLETE_CONFIG'} 

        rom = self.settings['game'].get('main_file') 

        if not os.path.exists(rompath): 

            return {'error': 'FILE_NOT_FOUND', 'file': rom} 

        device = self.settings['game'].get('device') 

        command = [self.executable, 

                   '-rompath', "\"%s\"" % rompath, machine, 

                   '-' + device, "\"%s\"" % rom] 

        return {'command': command}