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

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

""" Runner for Atari ST computers """ 

 

from lutris.runners.runner import Runner 

import os 

 

 

class hatari(Runner): 

    """Atari ST computers""" 

    package = "hatari" 

    executable = "hatari" 

    platform = "Atari ST computers" 

 

    game_options = [ 

        { 

            "option": "disk-a", 

            "type": "file", 

            "label": "Floppy Disk A" 

        }, 

        { 

            "option": "disk-b", 

            "type": "file", 

            "label": "Floppy Disk B" 

        } 

    ] 

 

    joystick_choices = [ 

        ('None', 'none'), 

        ('Keyboard', 'keys'), 

        ('Joystick', 'real') 

    ] 

 

    runner_options = [ 

        { 

            "option": "bios_file", 

            "type": "file", 

            "label": "Bios File (TOS.img)" 

        }, 

        { 

            "option": "fullscreen", 

            "type": "bool", 

            "label": "Fullscreen" 

        }, 

        { 

            "option": "zoom", 

            "type": "bool", 

            "label": "Double ST low resolution" 

        }, 

        { 

            "option": "borders", 

            "type": "bool", 

            'label': 'Add borders to display' 

        }, 

        { 

            "option": "status", 

            "type": "bool", 

            'label': 'Display status bar' 

        }, 

        { 

            "option": "joy0", 

            "type": "choice", 

            "label": "Joystick 1", 

            "choices": joystick_choices 

        }, 

        { 

            "option": "joy1", 

            "type": "choice", 

            "label": "Joystick 2", 

            "choices": joystick_choices 

        } 

    ] 

 

    def play(self): 

        """Run Atari ST game""" 

        if not self.is_installed(): 

            return {'error': 'RUNNER_NOT_INSTALLED', 

                    'runner': self.__class__.__name__} 

 

        params = [self.executable] 

        settings = self.runner_config 

        game_settings = self.settings['game'] or {} 

        if "fullscreen" in settings and settings["fullscreen"]: 

            params.append("--fullscreen") 

        else: 

            params.append("--window") 

 

        if "zoom" in settings and settings["zoom"]: 

            params.append("--zoom 2") 

        else: 

            params.append("--zoom 1") 

 

        if 'borders' in settings and settings["borders"]: 

            params.append('--borders true') 

        else: 

            params.append('--borders false') 

 

        if 'status' in settings and settings["status"]: 

            params.append('--statusbar true') 

        else: 

            params.append('--statusbar false') 

 

        if "joy1" in settings: 

            params.append("--joy0 " + settings['joy0']) 

 

        if "joy2" in settings: 

            params.append("--joy1 " + settings['joy1']) 

 

        if "bios_file" in settings: 

            if os.path.exists(settings['bios_file']): 

                params.append("--tos " + settings["bios_file"]) 

            else: 

                return { 

                    'error': 'FILE_NOT_FOUND', 

                    'file': settings['bios_file'] 

                } 

        else: 

            return {'error': 'NO_BIOS'} 

        diska = game_settings.get('disk-a') 

        if not os.path.exists(diska): 

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

        params.append("--disk-a \"%s\"" % diska) 

 

        return {"command": params}