Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| coding_rules [2021/10/19 00:25] – [How to add an emulator] es_features is just as important as es_systems atari | coding_rules [2022/07/21 02:43] (current) – add some bullet point coding rules atari | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| In other words, don't try to handle all cases if it makes the software complicated and unmaintainable. | In other words, don't try to handle all cases if it makes the software complicated and unmaintainable. | ||
| + | |||
| + | * Don't add new systems that are simply variations of other systems, aim to have one folder per system. An exception to this rule would be if a system required different configuration to launch, as asking the user to create two sets of custom emulator settings should be avoided. | ||
| + | * Don't put in [[: | ||
| + | * Build emulators from their source where possible. | ||
| + | * Don't add emulators that duplicate the function of other emulators. We must avoid redundancy as there is an upper limit as to how much data can be packed into the '' | ||
| + | * Avoid making patches if possible, encourage the source developer of the software to fix issues upstream. | ||
| + | * Avoid adding files to the '' | ||
| + | |||
| + | <WRAP center round info> | ||
| + | A timeline of when certain changes are allowed to be merged upstream can be found here: https:// | ||
| + | </ | ||
| ===== Project files ===== | ===== Project files ===== | ||
| - | The [[https:// | + | The [[https:// |
| + | |||
| + | The following directories are owned by Batocera: | ||
| ==== defconfig build files ==== | ==== defconfig build files ==== | ||
| Line 42: | Line 55: | ||
| </ | </ | ||
| - | ===== How to add an emulator | + | ===== Global features/ |
| - | - Install (its initial configuration script | + | Define global features and advanced system options |
| - | | + | |
| - | * You can check a list of system shortnames that can be automatically scraped for here: https:// | + | Syntax (replace everything including less-than and greater-than symbols (<>)): |
| - | - Add your system/ | + | |
| - | - Create and test its config generator | + | <code yaml> |
| - | - Define the generator | + | < |
| - | - Include it in the packages list (syntax: | + | group: <group name> # An optional group to sort this feature under. This is mostly used to categorize " |
| - | - Create the "main" | + | features: [<common feature 1>, <common feature 2>, <...>] # All the global options applicable to this emulator. |
| - | - If appropriate, split the file into multiple Python scripts called by < | + | cfeatures: # Custom features, found in the advanced settings. |
| - | - Call the files as appropriate | + | <batocera.conf key name 1>: # This is what is written as the key name to batocera.conf |
| - | - Configure the default emulator (if you've added a whole new system) with https:// | + | archs_include: |
| - | - Configure | + | prompt: |
| - | - Limit your emulator to particular platforms (most typically, most complex standalone emulators are x86/x86_64 only) with https://github.com/ | + | description: < |
| - | - If BIOS files are required, set them in https:// | + | choices: |
| + | "< | ||
| + | "< | ||
| + | "<...>": | ||
| + | < | ||
| + | < | ||
| + | # This section is optional. If there are settings | ||
| + | # system, you can add them in here. | ||
| + | | ||
| + | <system | ||
| + | < | ||
| + | <...> # As above. | ||
| + | < | ||
| + | < | ||
| + | </code> | ||
| + | |||
| + | Here's an example: | ||
| + | |||
| + | <code yaml> | ||
| + | dolphin: | ||
| + | features: [ratio] | ||
| + | cfeatures: | ||
| + | gfxbackend: | ||
| + | archs_include: | ||
| + | prompt: | ||
| + | description: | ||
| + | choices: | ||
| + | " | ||
| + | " | ||
| + | perf_hacks: | ||
| + | group: ADVANCED OPTIONS | ||
| + | prompt: | ||
| + | description: | ||
| + | choices: | ||
| + | " | ||
| + | " | ||
| + | systems: | ||
| + | wii: | ||
| + | cfeatures: | ||
| + | emulatedwiimotes: | ||
| + | group: ADVANCED OPTIONS | ||
| + | prompt: | ||
| + | description: | ||
| + | choices: | ||
| + | " | ||
| + | " | ||
| + | </code> | ||
| + | |||
| + | Spacing is everything here. Triple-check that you have used the correct amount of indentation. If your build fails to compile because of errors related to '' | ||
| + | |||
| + | <WRAP center round tip> | ||
| + | A new way to use options is available as presets, read more about it on [[https:// | ||
| + | |||
| + | (FIXME how is this done in Batocera, though?) | ||
| + | </WRAP> | ||
| + | |||
| + | General practice isn't to be a one-for-one representation of the settings available to the emulator, that would defy the point of Batocera. Important settings that may need to be changed frequently/ | ||
| + | |||
| + | <code python> | ||
| + | # Various performance hacks - Default Off | ||
| + | if system.isOptSet(' | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | | ||
| + | dolphinGFXSettings.set(" | ||
| + | dolphinGFXSettings.set(" | ||
| + | else: | ||
| + | if dolphinGFXSettings.has_section(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | if dolphinGFXSettings.has_section(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | dolphinGFXSettings.remove_option(" | ||
| + | </code> | ||
| + | |||
| + | ==== Multi-line descriptions ==== | ||
| + | |||
| + | Use of multi-line descriptions is discouraged, but for excessively complicated options requiring more detailed descriptions exceptions can be made. | ||
| + | |||
| + | A multi-line description can be enabled by prepending | ||
| + | |||
| + | <code yaml> | ||
| + | [...] | ||
| + | prompt: HEADS UP DISPLAY | ||
| + | description: | ||
| + | Show context-sensitive info | ||
| + | over the game | ||
| + | | ||
| + | and a 4th line. | ||
| + | | ||
| + | [...] | ||
| + | </code> | ||
| - | If you'd like an example of a recent pull request that adds a whole new emulator: https:// | ||
| ===== How emulator configuration applies ===== | ===== How emulator configuration applies ===== | ||
| Line 67: | Line 183: | ||
| * Only update values controlled by Batocera | * Only update values controlled by Batocera | ||
| - | Configuration handled by Batocera comes from three places: | + | Configuration handled by Batocera comes from: |
| * the configgen plugin. hardcoded or dependant on non user values (the number of plugged pads for example) | * the configgen plugin. hardcoded or dependant on non user values (the number of plugged pads for example) | ||
| * **configgen-defaults.yml** the default configuration | * **configgen-defaults.yml** the default configuration | ||
| Line 73: | Line 189: | ||
| * **batocera.conf** The settings file saved to by EmulationStation or manually edited by the user. Contains keys such as '' | * **batocera.conf** The settings file saved to by EmulationStation or manually edited by the user. Contains keys such as '' | ||
| - | Note: ideally, '' | + | <WRAP center round info> |
| + | Ideally, '' | ||
| + | </ | ||
| ===== Patches ===== | ===== Patches ===== | ||
| Line 92: | Line 210: | ||
| In case a modification to a Buildroot file is absolutely necessary, prefix each paragraph by '# batocera' | In case a modification to a Buildroot file is absolutely necessary, prefix each paragraph by '# batocera' | ||
| + | |||
| + | === When to merge buildroot === | ||
| + | The good way to update buildroot packages is to merge the last official buildroot tree (stable if possible). | ||
| + | During last month before a release, we avoid buildroot merges to avoid adding unpredictable bugs. | ||
| + | There are some cases we can merge buildroot packages directly, because it worth to have up to date packages. It includes : | ||
| + | * mesa packages (gpu drivers) | ||
| + | * pipewire packages (because it is in a very active phase and solving regularly issues) | ||
| + | * linux-firmwares (because it is incrementing files, not real risk) | ||
| + | * rpi kernels (to be up to date) | ||
| + | * rust (because ruffle uses the last versions) | ||
| + | * linux LTS kernels | ||
- coding_rules.1634603150.txt.gz
- Last modified: 5 years ago
- by atari