This file is indexed.

/usr/share/games/renpy/common/_layout/imagemap_load_save.rpym is in renpy 6.12.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# Copyright 2004-2011 Tom Rothamel <pytom@bishoujo.us>
# See LICENSE.txt for license details.

init python:

    layout.provides('load_save')
    renpy.load_module("_layout/imagemap_common")
    
    # The ground image.
    config.load_save_ground = { }

    # The idle image.
    config.load_save_idle = { }

    # The hover image.
    config.load_save_hover = { }

    # The selected idle image.
    config.load_save_selected_idle = { }

    # The selected hover image.
    config.load_save_selected_hover = { }

    # The hotspots. Each hotspot is defined by a tuple giving:
    # - The x-coordinate of the left side.
    # - The y-coordinate of the top side.
    # - The x-coordinate of the right side.
    # - The y-coordinate of the bottoms side.
    # - The name of the button or slider this is equivalent to.
    config.load_save_hotspots = { }
    
    # Define styles
    style.file_picker_text = Style(style.large_button_text, help="text inside a file picker entry")
    style.file_picker_empty_slot = Style(style.file_picker_text, help="text inside an empty file picker entry slot")
    style.file_picker_text_window = Style(style.default, help="a window containing the file picker text.") 
    style.file_picker_ss_window = Style(style.default, help="a window containing the screenshot.")

    # Should we disable thumbnails?
    config.disable_thumbnails = False
    
    # The default thumbnail to use when no file exists.
    config.load_save_empty_thumbnail = None
    
    # How we format time in a file entry.
    config.time_format = "%b %d, %H:%M"

    # How we format a file entry.
    config.file_entry_format = "%(time)s\n%(save_name)s"

    # True if we should prompt before loading a game.
    _load_prompt = True

    # This is used to store scratch data that's used by the
    # library, but shouldn't be saved out as part of the savegame.
    __scratch = object()
    __scratch.file_picker_page = None
    __scratch.initialized = False
    __scratch.per_page = 0
    __scratch.pages = 0
    __scratch.has_autosave = False
    __scratch.has_quicksave = False
    
    def _render_savefile(ime, index, name, extra_info, screenshot, mtime, newest, clicked):

        import time

        (x1, y1, x2, y2) = ime.button(
            "slot_%d" % index, clicked, newest,
            keymap={ "save_delete" : ui.returns(("unlink", name)) })

        ui.fixed(xpos=x1, ypos=y1, xmaximum=x2-x1, ymaximum=y2-y1)
        
        if not config.disable_thumbnails:
            ui.window(style=style.file_picker_ss_window[index])
            ui.add(screenshot)

        s = name + ". " + config.file_entry_format % dict(
            time=time.strftime(config.time_format,
                               time.localtime(mtime)),
            save_name=extra_info)

        ui.window(style=style.file_picker_text_window[index])
        ui.text(s, style=style.file_picker_text[index])

        ui.close()
        
    def _render_new_slot(ime, index, name, clicked):

        (x1, y1, x2, y2) = ime.button("slot_%d" % index, clicked, False)
        
        ui.fixed(xpos=x1, ypos=y1, xmaximum=x2-x1, ymaximum=y2-y1)

        if not config.disable_thumbnails:

            if config.load_save_empty_thumbnail:
                ui.window(style=style.file_picker_ss_window[index])
                ui.add(config.load_save_empty_thumbnail)
        
        ui.window(style=style.file_picker_text_window[index])
        ui.text(name + ". " + _(u"Empty Slot.") + "\n", style=style.file_picker_empty_slot[index])

        ui.close()


    # This function is given a page, and should map it to the names
    # of the files on that page.
    def _file_picker_page_files(page):

        per_page = __scratch.per_page
        rv = [ ]

        if __scratch.has_autosave:
            if page == 0:
                for i in range(1, per_page + 1):
                    rv.append(("auto-" + str(i), _(u"a") + str(i), True))

                return rv
            else:
                page -= 1

        if __scratch.has_quicksave:
            if page == 0:
                for i in range(1, per_page + 1):
                    rv.append(("quick-" + str(i), _(u"q") + str(i), True))

                return rv
            else:
                page -= 1

        for i in range(per_page * page + 1, per_page * page + 1 + per_page):
            rv.append(("%d" % i, "%d" % i, False))

        return rv

    # Given a filename, returns the page that filename is on. 
    def _file_picker_file_page(filename):

        per_page = __scratch.per_page

        base = 0

        if __scratch.has_autosave:
            if filename.startswith("auto-"):
                return base
            else:
                base += 1

        if __scratch.has_quicksave:
            if filename.startswith("quick-"):
                return base
            else:
                base += 1

        try:
            return base + int((int(filename) - 1) / per_page)
        except:
            return base
        
    # Processes a screenshot.
    def _file_picker_process_screenshot(s):
        return s

    # Initialize the scratch information.
    def _file_picker_init():

        hotspots = set()

        if isinstance(config.load_save_hotspots, dict):
            for d in config.load_save_hotspots.values():
                for (x1, y1, x2, y2, name) in d:
                    hotspots.add(name)
        else:
            for (x1, y1, x2, y2, name) in config.load_save_hotspots:
                hotspots.add(name)

        __scratch.has_autosave = ("page_auto" in hotspots)
        __scratch.has_quicksave = ("page_quick" in hotspots)

        __scratch.per_page = 0

        while ("slot_%d" % __scratch.per_page) in hotspots:
            __scratch.per_page += 1

        __scratch.pages = 1
            
        while ("page_%d" % __scratch.pages) in hotspots:
            __scratch.pages += 1

        __scratch.pages -= 1

    def _file_picker_pages():

        rv = [ ]

        if config.has_autosave:
            rv.append("page_auto")

        if config.has_quicksave:
            rv.append("page_quick")

        for i in range(1, __scratch.pages + 1):
            rv.append("page_%d" % i)

        return rv
           
    
    # This displays a file picker that can chose a save file from
    # the list of save files.
    def _file_picker(screen, save):

        if not __scratch.initialized:
            __scratch.initialized = True
            _file_picker_init()
        
        # The number of slots in a page.
        file_page_length = __scratch.per_page

        update = True
        
        while True:

            if update:
                
                update = False
                
                saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')

                newest = None
                newest_mtime = None
                save_info = { }

                for fn, extra_info, screenshot, mtime in saved_games:
                    screenshot = _file_picker_process_screenshot(screenshot)
                    save_info[fn] = (extra_info, screenshot, mtime)

                    if not fn.startswith("auto-") and mtime > newest_mtime:
                        newest = fn
                        newest_mtime = mtime

                # The index of the first entry in the page.
                fpp = __scratch.file_picker_page

                if fpp is None:

                    if newest:
                        fpp = _file_picker_file_page(newest)
                    else:
                        fpp = _file_picker_file_page("1")


            if fpp < 0:
                fpp = 0

            __scratch.file_picker_page = fpp

            ime = _ImageMapper(
                screen,
                config.load_save_ground,
                config.load_save_idle,
                config.load_save_hover,
                config.load_save_selected_idle,
                config.load_save_selected_hover,
                config.load_save_hotspots,
                variant=screen)
                

            def tb(enabled, label, clicked, selected):

                if not enabled:
                    return

                ime.button(label, clicked, selected)

            # Previous
            tb(fpp > 0, 'previous', ui.returns(("fppdelta", -1)), selected=False)

            # Quick Access
            for i, name in enumerate(_file_picker_pages()):
                tb(True, name, ui.returns(("fppset", i)), fpp == i)

            # Next
            tb(True, 'next', ui.returns(("fppdelta", +1)), False)

            # This draws a single slot.
            def entry(name, filename, offset, ro):
                clicked = ui.returns(("return", filename))
                
                if filename not in save_info:
                    if (not save) or ro:
                        clicked = None

                    _render_new_slot(ime, offset, name, clicked)

                else:
                    if save and ro:
                        clicked = None

                    extra_info, screenshot, mtime = save_info[filename]
                    _render_savefile(ime,
                                     offset,
                                     name,
                                     extra_info,
                                     screenshot,
                                     mtime,
                                     newest == filename,
                                     clicked)

            for i, (filename, name, ro) in enumerate(_file_picker_page_files(fpp)):
                entry(name, filename, i, ro)

            ime.close()
                
            result = ui.interact(mouse="gamemenu")
            type, value = result

            if type == "unlink":
                if layout.yesno_prompt(screen, layout.DELETE_SAVE):
                    renpy.unlink_save(value)
                    update = True

            if type == "return":
                return value

            if type == "fppdelta":
                fpp += value

            if type == "fppset":
                fpp = value


label save_screen:

    python hide:
        while True:
            fn = _file_picker("save", True)

            if renpy.can_load(fn):
                if not layout.yesno_prompt("save", layout.OVERWRITE_SAVE):
                    continue

            renpy.save(fn, extra_info=store.save_name)


label load_screen:

    python hide:
        while True:
            fn = _file_picker("load", False)
            
            if _load_prompt:
                if not layout.yesno_prompt("load",  layout.LOADING):
                    continue

            renpy.load(fn)
                        
init python hide:
    def auto_save_extra_info():
        return save_name
    config.auto_save_extra_info = auto_save_extra_info