/* * * Singe 3 * Copyright (C) 2006-2026 Scott Duensing * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * */ #ifndef SINGE_H #define SINGE_H #include #include "common.h" #include "generated/version.h" #include "videoPlayer.h" #define SINDEN_ARG_MAX 8 typedef enum ToolModeE { TOOL_NONE = 0, TOOL_PACK, TOOL_PATCH, TOOL_UNPACK } ToolModeE; // Where the Sinden light gun border sits. Auto puts it at the window's edge when a bezel is // loaded (the gun's camera sees the whole screen) and around the picture when none is. typedef enum SindenEdgeE { SINDEN_EDGE_AUTO = 0, SINDEN_EDGE_VIDEO, SINDEN_EDGE_WINDOW } SindenEdgeE; // Number of --sindengun arguments selects the border style. typedef enum SindenModeE { SINDEN_WHITE = 1, SINDEN_WHITE_BLACK = 2, SINDEN_CUSTOM_WHITE = 4, SINDEN_CUSTOM_WHITE_BLACK = 5, SINDEN_CUSTOM_WHITE_CUSTOM_BLACK = 8 } SindenModeE; // Options typed on the command line: a games.dat entry found beside a loose script leaves these alone. typedef enum GivenE { GIVEN_VIDEO = 1 << 0, // -v or -D GIVEN_STRETCH = 1 << 1, GIVEN_NO_MOUSE = 1 << 2, GIVEN_RESOLUTION = 1 << 3, // -x or -y GIVEN_SINDEN = 1 << 4, GIVEN_AUDIO_TRACK = 1 << 5, GIVEN_AUDIO_DELAY = 1 << 6, GIVEN_CANVAS = 1 << 7, GIVEN_AUDIO_SUFFIX = 1 << 8, GIVEN_SCALE = 1 << 9, GIVEN_SHIFT = 1 << 10, // -X or -Y GIVEN_ROTATE = 1 << 11 } GivenE; typedef struct ConfigS { char *videoFile; char *scriptFile; char *container; // Game database holding the script, NULL for a loose game int32_t entry; // Which games.dat entry a database launch runs, from 1 char *toolSource; // Argument of --pack, --unpack, or --patch ToolModeE toolMode; uint32_t given; // GivenE bits char *gameDir; // -G: where the games and the Singe folder live; becomes the working directory char *bezelFile; // --bezel: the artwork image inside the bezels folder char *bezelDir; // --bezeldir: the folder holding it, in place of "bezels" char *dataDir; char *dataDirBase; char *keymapFile; // --keymapfile: the controls.cfg to read in place of the four place search char *audioSuffix; // --altaudio: the disc audio suffix discAudioSuffix takes, applied at startup char *soundfont; // --soundfont: the .sf2 MIDI files are synthesised with, in place of the search DeinterlaceE deinterlace; // --deinterlace: what an interlaced picture gets, automatic by default char *gamepadOrder; // --gamepad_reorder: enumeration positions, one per gamepad slot, as Hypseus writes them bool resolutionWasCalculated; bool isFrameFile; bool stretchVideo; bool noMouse; bool noCrosshair; bool noSound; bool fullScreen; bool fullScreenWindow; bool showCalculated; bool noConsole; bool noLogos; bool programTracing; bool reload; // --reload: watch the loose script files and rerun the game when one changes; F5 too bool scriptTracing; bool legacySpriteArgs; bool bezelFlip; // --bezelflip: the artwork draws in front of the picture instead of behind it bool disc; // Play a laserdisc video; otherwise the canvas is the world bool softwareVideo; // Skip the platform's hardware decoder bool noGamepad; // --nogamepad: ignore every gamepad, as --nomouse ignores the mice bool mapJoysticks; // --mapjoysticks: write a gamepad mapping for a device SDL does not recognise bool joyMouse; // --joymouse: the first gamepad's left stick drives the mouse cursor bool manyMouse; // --manymouse: the user asks for one mouse device per player, whatever the game asks for bool absolutesOnly; // --absolutes_only: keep only the mice that report absolute positions, which is what light guns do bool startSilent; // --startsilent: muted until the first input of any kind bool monochrome; // --monochrome: the disc picture starts in greyscale bool linearScale; // --linearscale: the overlay starts filtered linearly, which is the default bool deterministic; // --deterministic: run on a virtual clock stepped once a frame, so a test repeats int32_t bestRatioIndex; int32_t volumeVldp; int32_t volumeNonVldp; int32_t scaleFactor; // --scalefactor: overscan compensation, per cent of the logical rectangle int32_t shiftX; // --shiftx: per cent of half the logical width the picture moves right int32_t shiftY; // --shifty: per cent of half the logical height the picture moves down int32_t rotate; // --rotate: clockwise presentation rotation, 0, 90, 180 or 270 degrees char *gameId; // GAME_ID from games.dat: the master service's stable id for this game int32_t xResolution; int32_t yResolution; int32_t canvasWidth; // World size when there is no disc int32_t canvasHeight; int32_t sindenEdge; // --sindenedge: SindenEdgeE, where the border rings are drawn int32_t sindenArgc; int32_t sindenArgv[SINDEN_ARG_MAX]; int32_t audioOutputTrack; int32_t audioDelayMs; // Positive when the audio device is heard later than it reports int32_t screen; // --screen: which display the window opens on, from 1; 0 is the primary int32_t idleExitSeconds; // --idleexit: quit after this long with no input; 0 never quits int32_t haptic; // --haptic: the strongest rumble step a script may ask for; 0 is no rumble int32_t joyMouseRange; // --js_range: video pixels a frame the cursor moves at full stick deflection int32_t deterministicStep; // --deterministic=MS: simulated milliseconds a frame, and the seed the generators start from double triggerThreshold; // --trigger_threshold: per cent of full travel a trigger counts as pressed at; 0 uses the dead zone double ratioX; // --xratio: the gun coordinate scale a script reads with ratioGetX double ratioY; // --yratio: the same for ratioGetY double fValue; // --fvalue: the launcher's one number, read with getFValue } ConfigT; // One key of the settings file, and the file that set it, so an error can name both. typedef struct SettingS { char *key; char *value; char *source; } SettingT; ConfigT *confFromDatabase(const ConfigT *conf); ConfigT *confFromGamesDat(const ConfigT *conf); void settingsFree(SettingT *settings, int32_t count); SettingT *settingsLoad(const ConfigT *conf, int32_t *count); void singe(SDL_Window *window, SDL_Renderer *renderer, SDL_GPUDevice *device, ConfigT *conf); #endif // SINGE_H