Skip to content

Commit

Permalink
Update docs and CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
LavenderSnek committed Nov 4, 2023
1 parent 556cec1 commit 01ddd78
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 66 deletions.
59 changes: 4 additions & 55 deletions docs/settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,20 @@ User Prefs
----------

When setting these as system properties from the command line, prefix them with `com.group_finity.mascot.prefs.`.
For example, to set the `Sounds` property to false from the command line, run shimeji like this:
For example, to set the `FixRelativeGlobalSound` property to false from the command line, run shimeji like this:

```shell
java -Dcom.group_finity.mascot.prefs.Sounds=false -jar ShimejiEE.jar
java -Dcom.group_finity.mascot.prefs.FixRelativeGlobalSound=true -jar ShimejiEE.jar
```

Properties set from the command line take priority over those read from the settings file.

### Toggles

| Name | Description | Default |
|----------------------------|------------------------------------------------------------------------|---------|
| `Breeding` | Allow shimeji to spawn other shimeji | `true` |
| `Transients` | Allow shimeji to spawn other if the new shimeji is marked as transient | `true` |
| `Transformation` | Allow shimeji to transform between image sets | `true` |
| `Throwing` | Allow shimeji to move/throw windows | `true` |
| `Sounds` | Allow shimeji to play sound | `true` |
| `TranslateBehaviorNames` | Translate behaviour names to more readable forms in menus | `true` |
| `AlwaysShowShimejiChooser` | Show the image set chooser on startup regardless of selections | `false` |
| `IgnoreImagesetProperties` | Ignore any settings in `imageset.properties` files. | `false` |
For more info on the available options, look at the `shimejicli.py` file in docs.

### ImageSet specific

All of these are (except `Scaling`) are not written back to any of the settings files. Reloading mascots is necessary
for these changes to take effect.

To use these options, make a file called `imageset.properties` in the image set's isolated conf folder
To use these options without CLI, you can make a file called `imageset.properties` in the image set's isolated conf folder
(i.e `<image set name>/conf/imageset.properties`).
If these options are specified through the command line, they are only treated as defaults and the contents of
the `imageset.properties` file still take precedence unless `IgnoreImagesetProperties` is enabled.
Expand All @@ -44,41 +31,3 @@ the `imageset.properties` file still take precedence unless `IgnoreImagesetPrope
| `AsymmetryNameScheme` | Uses the `-r` suffix to find a separate ImageRight (if no ImageRight is provided). | `false` |
| `PixelArtScaling` | Enable this to use nearest neighbour interpolation for scaling. | `false` |
| `FixRelativeGlobalSound` | Whether to automatically fix missing sound files when they begin with `/../../sound/` | `false` |

### Misc.

| Name | Description |
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Language` | The language tag for the UI locale. Default value is english (`en`). |
| `ActiveShimeji` | A slash separated + url encoded list of selected image sets from the current img folder. For example the value `ImageSet1/abcd/lorem%2Fipsum/` would select `ImageSet1`, `abcd`, and `lorem/ipsum`. If an image set can't be loaded for any reason, it is discarded from the list of selected image sets. |



### Program Folder

These properties are command line only. They are not written back to settings on exit. The parent folder of the jar file
must still contain the `lib` and `conf` folders regardless of what these values are set to.

| Name | Description |
|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Name | Description |
| `ProgramFolder` | Path to the base program folder. This is used to resolve values that haven't been set more specifically. The default value is the jar file's parent directory. |
| `ProgramFolder.conf` | Path to the global conf folder. This does not affect settings or logging, only the default conf files and user behavior translations. |
| `ProgramFolder.img` | Path to the img folder. Needs to be a valid img folder. |
| `ProgramFolder.sound` | Path to global sound folder. |
| `ProgramFolder.mono` | (boolean) Whether the img folder directly contains the images. This was common in older versions of shimeji. It is recommended to set this value explicitly as the program's guess isn't 100% accurate. |
| `SettingsPath` | Input and output path for the settings file. Defaults to `<jar parent dir>/conf/settings.properties` regardless of the program folder settings. |



Other
-----

To pick the native implementation set the `com.group_finity.mascotnative` system property. These are the current options:

| Property | Notes | Compatibility |
|--------------|----------------------------------------------------------------|----------------|
| `generic` | A pure swing implementation with no environment interaction. | All (Sort of) |
| `macclassic` | Based on generic. Adds mac environment interactions using JNA. | macOS |
| `macjni` | JNI mac implementation, adds proper click through. WIP | macOS |
| `win` | Windows implementation using JNA | Windows |
55 changes: 44 additions & 11 deletions docs/shimejicli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,71 @@
# could be placed later to allow --help, but this feels like a better alert
if not os.path.isfile(SHIME_JAR):
print(f"jar path does not exist (edit cli script to change): {SHIME_JAR}\n", file=sys.stderr)
exit()
exit()

print(f"jar path (edit cli script to change): {SHIME_JAR}\n", file=sys.stderr)

javaCmd = [ "java",
"-Dsun.java2d.metal=true"
]

parser = argparse.ArgumentParser(description='Runs shimeji with the given settings.')

parser = argparse.ArgumentParser(description='Runs shimeji with the given settings. Its not really stable, but good enough for quick run configs.')

parser.add_argument('dirType', choices={'pf', 'img'}, help='dirType: program folder or img dir')
parser.add_argument('dirPath', help='Path to pf/img dir')
parser.add_argument('--mono', default=False, action='store_true', help='Mono imageset mode: searches for imageset files directly in img dir')
parser.add_argument('--mono', default=False, action='store_true', help='Mono imageset mode: searches for sprite files directly in img dir')

parser.add_argument('--select', '-s', required=False, help='Select image set', action='extend', nargs='*')

parser.add_argument('--native', required=False, help='Native implementation package name')

parser.add_argument('--scale', type=float, default=1.0, help='Global scaling')
parser.add_argument('--lanc', default=False, action='store_true', help='Logical anchors: images with same name can have copies with multiple anchors')
parser.add_argument('--asym', default=False, action='store_true', help='Asymmetry name scheme: do not ignore -r suffix for asymmetry')
parser.add_argument('--pix', default=False, action='store_true', help='Pixel art scaling: use nearest neighbour scaling')
parser.add_argument('--soundfix', default=False, action='store_true', help='Fix Relative Global Sound: Searches in local sound folder if xml uses relative paths to global folder')

# works well enough
parser.add_argument('--no-breed', default=False, action='store_true', help='Disallow shimeji to spawn other shimeji')
parser.add_argument('--no-transient', default=False, action='store_true', help='Disallow Transient shimeji in addition to breed')
parser.add_argument('--no-transform', default=False, action='store_true', help='Disable Transform actions')
parser.add_argument('--no-throw', default=False, action='store_true', help='Disable window throwing')
parser.add_argument('--no-sound', default=False, action='store_true', help='Disable sound')
parser.add_argument('--no-bvtr', default=False, action='store_true', help='Disable behaviour name translation')
parser.add_argument('--chooser', default=False, action='store_true', help='Show image set chooser on startup')
parser.add_argument('--ignore-imp', default=False, action='store_true', help='Ignore imageset.properties in inner conf folder')

args = parser.parse_args()

dsel = 'ProgramFolder' if args.dirType == 'pf' else 'ProgramFolder.img'
javaCmd.append(f"-D{P_PREFS}.{dsel}={args.dirPath}")
pfOrImg = 'ProgramFolder' if args.dirType == 'pf' else 'ProgramFolder.img'
javaCmd.append(f"-D{P_PREFS}.{pfOrImg}={args.dirPath}")
javaCmd.append(f"-D{P_PREFS}.ProgramFolder.mono={args.mono}")
if args.native is not None:

if args.native is not None:
javaCmd.append(f"-Dcom.group_finity.mascotnative={args.native}")


if args.select is not None and len(args.select) != 0:
import urllib.parse
selStr = ""
for s in args.select:
urllib.parse.quote_plus(s) + '/'
javaCmd.append(f"-D{P_PREFS}.ActiveShimeji={selStr}")

javaCmd.append(f"-D{P_PREFS}.Scaling={args.scale}")
javaCmd.append(f"-D{P_PREFS}.LogicalAnchors={args.lanc}")
javaCmd.append(f"-D{P_PREFS}.AsymmetryNameScheme={args.asym}")
javaCmd.append(f"-D{P_PREFS}.PixelArtScaling={args.pix}")
javaCmd.append(f"-D{P_PREFS}.FixRelativeGlobalSound={args.soundfix}")

javaCmd.append(f"-D{P_PREFS}.Breeding={not args.no_breed}")
javaCmd.append(f"-D{P_PREFS}.Transients={not args.no_transient}")
javaCmd.append(f"-D{P_PREFS}.Transformation={not args.no_transform}")
javaCmd.append(f"-D{P_PREFS}.Throwing={not args.no_throw}")
javaCmd.append(f"-D{P_PREFS}.Sounds={not args.no_sound}")
javaCmd.append(f"-D{P_PREFS}.TranslateBehaviorNames={not args.no_bvtr}")
javaCmd.append(f"-D{P_PREFS}.AlwaysShowShimejiChooser={args.chooser}")
javaCmd.append(f"-D{P_PREFS}.IgnoreImagesetProperties={args.ignore_imp}")

javaCmd.extend(["-jar", SHIME_JAR,])
javaCmd.extend(["-jar", SHIME_JAR])

subprocess.call(javaCmd)

0 comments on commit 01ddd78

Please sign in to comment.