Trying to add per-project persistent launcher settings

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Hentai Senshi
Regular
Posts: 105
Joined: Wed Aug 08, 2007 9:37 pm
Contact:

Trying to add per-project persistent launcher settings

#1 Post by Hentai Senshi »

I started a stab at one of my wishlist items for Ren'Py - tweaking the launcher so that launcher settings are per-project rather than global. At the moment, I'm trying to move the list of files to archive into the launcherinfo.py file. However, while I can change the project info within the archive_files label's code, the variable's value reverts to the prior value when the launcher jumps back to tools_menu.

At first I thought that it was python hide blocks at work, but taking 'hide' out of the python blocks doesn't fix it, and it doesn't look like it's related to changes inside calls not propagating to outer contexts, as tools_menu and archive_files seem to be in the same context.

I could just use a different file and reload its contents inside archive_files (in fact, that may be a good idea anyhow - any thoughts?) or reparse launcherinfo.py inside archive_files each time, but it seems like I'm either missing something important that will trip me up again elsewhere (and possibly others, so some form of documentation could help if this is a Feature), or I've stumbled upon a stray bug.
Attachments
launcher.rpy
(22.48 KiB) Downloaded 129 times
Project statii:
Yuri no Yume: Wet Night: Released!
Tentacularity: Released!
LoliFindsKitten: AlphaBetaThingy...

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Trying to add per-project persistent launcher settings

#2 Post by PyTom »

Hm... I'm going to declare that launcher.rpy isn't really intended for modification, so if you change it, it's up to you to debug what's wrong.

If I'm understanding what you wrote correctly, this bug can't happen in normal operation, so it isn't really a concern.

The launcher needs a rewrite, anyway...
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Hentai Senshi
Regular
Posts: 105
Joined: Wed Aug 08, 2007 9:37 pm
Contact:

Re: Trying to add per-project persistent launcher settings

#3 Post by Hentai Senshi »

After banging my head futilely on the way I was trying to produce persistent launcherinfo, I finally broke down and made it reread the info file at every interaction (which is generally annoying practice, but parsing a tiny text file a few times during 'build project' isn't that bad - and I can claim it's a feature because it means that edits to .launcherinfo will be picked up instantly in the event one's either being dumb and running two copies of Ren'Py or being clever and running a text editor on it.)

Anyhow, here's a minor launcher patch. It moves project info from launcherinfo.py to .launcherinfo (because quietly executing arbitrary code from documents gives me the creeps - if someone sticks a trojan in a game and releases it as 'example 3D FinalFantasy tentacle example', I would rather it wait until I _run_ the game to recursively remove all files I have write access to), saves distribution basename, ignored extensions, and archive basename in .launcherinfo, and adds a RENPY_EDITOR_FILESEPARATOR environment variable so I can more readily use vim as my default editor.

One caveat: I'm using rename to clobber the old .launcherinfo, and I'm not sure if that's reliable under Windows. Also, obviously, launcherinfo.py files will have to be converted into .launcherinfo to work.
Here's the .launcherinfo from the template, which will be required to create new projects with my patch:

Code: Select all

description=A template that can be used to make your own game. Not a very interesting game on its own.
ro=True
template=True
Attachments
per_project_launcherinfo_diff.txt
Patch to add per-project launcherinfo to renpy 6.8.1.
(10.79 KiB) Downloaded 122 times
Project statii:
Yuri no Yume: Wet Night: Released!
Tentacularity: Released!
LoliFindsKitten: AlphaBetaThingy...

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Trying to add per-project persistent launcher settings

#4 Post by PyTom »

Hm... I'm wondering if these files really need to be user-readable, or if we can get away with using a python pickle for the launcher info. If they have to be user-readable, then I'd much rather use a real language parser, which supports comments and so on.

(But if we're re-writing the data, that's not an issue, and might as well just use pickle.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Hentai Senshi
Regular
Posts: 105
Joined: Wed Aug 08, 2007 9:37 pm
Contact:

Re: Trying to add per-project persistent launcher settings

#5 Post by Hentai Senshi »

PyTom wrote:Hm... I'm wondering if these files really need to be user-readable, or if we can get away with using a python pickle for the launcher info. If they have to be user-readable, then I'd much rather use a real language parser, which supports comments and so on.

(But if we're re-writing the data, that's not an issue, and might as well just use pickle.)
A pickle would work - I'd prefer user-readability, but not if the price of that is to be automatic silent execution.
Project statii:
Yuri no Yume: Wet Night: Released!
Tentacularity: Released!
LoliFindsKitten: AlphaBetaThingy...

Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot]