Skip to content

Add plugin support to run NDSes for data files#5

Closed
chishm wants to merge 4 commits into
devkitPro:masterfrom
chishm:plugins
Closed

Add plugin support to run NDSes for data files#5
chishm wants to merge 4 commits into
devkitPro:masterfrom
chishm:plugins

Conversation

@chishm

@chishm chishm commented Oct 27, 2018

Copy link
Copy Markdown
Contributor

Add a new mechanism to construct command lines to run an NDS program with a selected data file as the argument. Plugins are placed in the /nds/plugins/ directory with the file extension they handle as the
name and an nds extension.

E.g. copy tuna-vids.nds to /nds/plugins/avi.nds and then you will be able to browse for and play .avi files.

Add a new mechanism to construct command lines to run an NDS program
with a selected data file as the argument. Plugins are placed in the
`/nds/plugins/` directory with the file extension they handle as the
name and an nds extension. E.g. copy `tuna-vids.nds` to
`/nds/plugins/avi.nds` and then you will be able to browse for and play
`.avi` files.

Also refactor main() to move `.argv` support to its own function.
Browse for files starting from the root directory if plugins are loaded
because data files could be anywhere on the file system and it's more
effort to select `[..]` at every start up.
@WinterMute

Copy link
Copy Markdown
Member

I'm not at all keen on this approach.

Personally I'd rather have files that specify file associations rather than renaming nds files to the extension they can handle. This approach is going to lead to duplication of binaries for no better reason than they support multiple file formats.

This isn't plugin support either.

@chishm

chishm commented Nov 11, 2018

Copy link
Copy Markdown
Contributor Author

I'm not at all keen on this approach.

No problem, I'll rework this to be something better.

Personally I'd rather have files that specify file associations rather than renaming nds files to the extension they can handle. This approach is going to lead to duplication of binaries for no better reason than they support multiple file formats.

I've got a few ways in mind:

  1. One big text file that specifies extension-to-handler mapping. It would look something like:

    mp3: mp3-player.nds <extra arg>
    m3u: mp3-player.nds <different arg>
    avi: avi-player.nds
    

    Pros:

    • Only one file to open and read at startup
    • One place to direct users to edit

    Cons:

    • Installation of (some) homebrew is no longer as easy as dropping a file in a directory, as users must edit the handler mapping file.
  2. One file per .nds that specifies extensions that the .nds can handle. E.g. for a homebrew named program.nds that can handle .mp3 and .m3u files it would be named program.ext and contain:

    mp3: <extra arg>
    m3u
    

    Pros:

    • Drop-in installation of handler mapping files

    Cons:

    • Need to read and parse every handler map at startup
    • Potential conflict if two homebrew can both handle the same file extension
    • More complicated syntax
  3. One file per extension, the contents specify which .nds to open. E.g. for the same homebrew as before, there would be two files: mp3.ext and m3u.ext, and both would contain:

    program.nds <optional extra args>...
    

    Pros:

    • Drop-in installation of handler mapping files
    • No conflicts possible
    • No need to read and parse every handler map at startup because the file extensions that can be handled are given directly from the file names
    • Possibility to add extra args to command line
    • Syntax is the same as .argv files, with the file-to-be-opened tacked onto the end

    Cons:

    • More files in the file system
    • Don't know if the handler exists until trying to start it

I prefer approach 3, but let me know if you have a different preference.

This isn't plugin support either.

Naming is a hard problem in computer science and "plugin" was just the first thing that came to mind. We can go with "handler" (as above) in the documentation, or something different if you prefer.

Also, what are your thoughts on changing the startup directory based on the presence of plugins/handlers (commit b8c3131)?

@WinterMute

Copy link
Copy Markdown
Member

Superseded by #6

@WinterMute WinterMute closed this Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants