Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preset path wildcard replacement #16

Closed
chyyran opened this issue Mar 14, 2023 · 2 comments · Fixed by #37
Closed

Preset path wildcard replacement #16

chyyran opened this issue Mar 14, 2023 · 2 comments · Fixed by #37
Labels
enhancement New feature or request

Comments

@chyyran
Copy link
Member

chyyran commented Mar 14, 2023

Implement path wildcard replacement from libretro/RetroArch#15023

It remains to be seen whether or not presets will use these wildcards but librashader should eventually add support for them via a context object if they see common use.

Some wildcards can be inferred from when loading from path.

  • $VID-DRV-SHADER-EXT$ is always .slang for librashader.
  • $VID-DRV-PRESET-EXT$ is always .slangp for librashader.
  • $PRESET_DIR$ can be inferred at load time.
  • $PRESET$ can be inferred at load time.

The remaining wildcards can be represented with structs; this gives a the context object that can be #[repr(C)].

  • $VID_DRIV$ is a static enum
     #[repr(C)]
     pub enum GraphicsRuntime {
         OpenGL = 0,
         Vulkan = 1,
         Direct3D11 = 2,
         Direct3D12 = 3
     } 
  • $CORE-REQ-ROT$, $VID-USER-ROT$, $SCREEN-ORIENT$ can be represented by an integer mod 4 as quarter-rotations on the unit circle (i.e. 0 = 0, 1 = 90deg, 2 = 180deg, 3 = 270deg).
  • $VID-FINAL-ROT$ is calculated as the sum of $CORE-REQ-ROT$ and $VID-USER-ROT$.
  • $VIEW-ASPECT-ORIENT$, $CORE-ASPECT-ORIENT$ , $VID-ALLOW-CORE-ROT$ will be encoded as booleans.
  • $CORE$ , $GAME$, and $CONTENT-DIR$ will have to be parsed from C strings owned by the caller.

Example C struct definition:

struct libra_context_t {
  LIBRA_RUNTIME runtime;
  uint8_t core_rotation;
  uint8_t user_rotation;
  bool core_aspect_vertical;
  bool view_aspect_vertical;
  bool allow_core_rotation;
  char* core_name;
  char* game_name;
  char* context_directory;
}

Because paths are canonicalized, this information needs to be available at preset parse time.

@chyyran chyyran added the enhancement New feature or request label Mar 14, 2023
@HyperspaceMadness
Copy link

This sounds really great!!! I'm curious if you have support for the reference chaining and params files what I put into Retroarch. feel free to contact me on the libretro forum, or at HyperspaceMadness@outlook.com I have some ideas I'd like to discuss with you if you are interested :)

@chyyran
Copy link
Member Author

chyyran commented May 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants