mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
Dispose of Boost, switch to JSON5 for configuration
This commit is contained in:
parent
0f0d81a8bb
commit
e79b4ced32
7 changed files with 474 additions and 517 deletions
15
README.md
15
README.md
|
@ -22,8 +22,6 @@ This binding should support RGSS1, RGSS2 and RGSS3, though I've only tested it w
|
|||
## Dependencies / Building
|
||||
|
||||
* ObjFW
|
||||
* Boost.Unordered (headers only)
|
||||
* Boost.Program_options
|
||||
* libsigc++ 2.0
|
||||
* PhysFS (latest hg)
|
||||
* OpenAL
|
||||
|
@ -36,8 +34,7 @@ This binding should support RGSS1, RGSS2 and RGSS3, though I've only tested it w
|
|||
* pixman
|
||||
* zlib (only ruby bindings)
|
||||
* OpenGL header (alternatively GLES2 with `-Dcpp_args=-DGLES2_HEADER`)
|
||||
* libiconv (on Windows, optional with INI_ENCODING)
|
||||
* libguess (optional with INI_ENCODING)
|
||||
* libiconv (macOS only)
|
||||
|
||||
(* For the F1 menu to work correctly under Linux/X11, you need latest hg + [this patch](https://bugzilla.libsdl.org/show_bug.cgi?id=2745))
|
||||
|
||||
|
@ -49,8 +46,6 @@ Midi support is enabled by default and requires fluidsynth to be present at runt
|
|||
|
||||
By default, mkxp switches into the directory where its binary is contained and then starts reading the configuration and resolving relative paths. In case this is undesired (eg. when the binary is to be installed to a system global, read-only location), it can be turned off by adding `-Dworkdir_current=true` to meson's build arguments.
|
||||
|
||||
To auto detect the encoding of the game title in `Game.ini` and auto convert it to UTF-8, build with `-Dini_encoding=true`. Requires iconv implementation and libguess. If the encoding is wrongly detected, you can set the "titleLanguage" hint in mkxp.conf.
|
||||
|
||||
**MRI-Binding**: By default, meson will search for Ruby 1.8 libraries and includes within the system search path. This can be adjusted with `-Dcpp_args=-I[path]` for includes and `-Dcpp_link_args=-L[path]` for libraries. For newer Ruby versions, pkg-config will look for `ruby-X.Y.pc`, where `X` is the major version number and `Y` is the minor version number (e.g. `ruby-2.6.pc`). The version that will be searched for can be set with `-Dmri_version=X.Y` (`-Dmri_version=2.6` as an example).
|
||||
|
||||
## Supported image/audio formats
|
||||
|
@ -67,13 +62,7 @@ A few notes on compatibility differences compared to RMXP:
|
|||
|
||||
## Configuration
|
||||
|
||||
mkxp reads configuration data from the file "mkxp.conf". The format is ini-style. Do *not* use quotes around file paths (spaces won't break). Lines starting with '#' are comments. See 'mkxp.conf.sample' for a list of accepted entries.
|
||||
|
||||
All option entries can alternatively be specified as command line options. Any options that are not arrays (eg. RTP paths) specified as command line options will override entries in mkxp.conf. Note that you will have to wrap values containing spaces in quotes (unlike in mkxp.conf).
|
||||
|
||||
The syntax is: `--<option>=<value>`
|
||||
|
||||
Example: `./mkxp --gameFolder="my game" --vsync=true --fixedFramerate=60`
|
||||
mkxp reads configuration data from the file "mkxp.json". The format is JSON5. Lines starting with '//' are comments. See 'mkxp.json.sample' for a list of accepted entries.
|
||||
|
||||
## Win32API
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
#include "config.h"
|
||||
#include "audio.h"
|
||||
#include "lang-fun.h"
|
||||
|
||||
#include "boost-hash.h"
|
||||
#include <vector>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -604,7 +606,7 @@ static void runRMXPScripts(BacktraceData &btData)
|
|||
// Can be force-disabled similarly to framerate options
|
||||
#ifndef NO_PRELOAD_SCRIPTS
|
||||
/* Execute preloaded scripts */
|
||||
for (std::set<std::string>::iterator i = conf.preloadScripts.begin();
|
||||
for (std::vector<std::string>::const_iterator i = conf.preloadScripts.begin();
|
||||
i != conf.preloadScripts.end(); ++i)
|
||||
runCustomScript(*i);
|
||||
|
||||
|
|
315
mkxp.conf.sample
315
mkxp.conf.sample
|
@ -1,315 +0,0 @@
|
|||
# Lines starting with '#' are comments.
|
||||
#
|
||||
# About filesystem paths specified in this config:
|
||||
# The "gameFolder" path is resolved either relative
|
||||
# to the directory containing the mkxp executable
|
||||
# (the default behavior), or relative to the current
|
||||
# working directory (when compiled with
|
||||
# -DWORKDIR_CURRENT). All other paths are resolved
|
||||
# relative to gameFolder and ignoring both RTPs and
|
||||
# encrypted archives.
|
||||
|
||||
|
||||
# Specify the RGSS version to run under.
|
||||
# Possible values are 0, 1, 2, 3. If set to 0,
|
||||
# mkxp will try to guess the required version
|
||||
# based on the game files found in gameFolder.
|
||||
# If this fails, the version defaults to 1.
|
||||
# (default: 0)
|
||||
#
|
||||
# rgssVersion=1
|
||||
|
||||
|
||||
# Create a debug context and log
|
||||
# OpenGL debug information to the console
|
||||
# (default: disabled)
|
||||
#
|
||||
# debugMode=false
|
||||
|
||||
|
||||
# Continuously print average FPS to console.
|
||||
# This setting does not affect the window title
|
||||
# FPS display toggled via F2
|
||||
# (default: disabled)
|
||||
#
|
||||
# printFPS=false
|
||||
|
||||
|
||||
# Game window is resizable
|
||||
# (default: enabled)
|
||||
#
|
||||
# winResizable=true
|
||||
|
||||
|
||||
# Start game in fullscreen (this can
|
||||
# always be toggled with Alt-Enter at runtime)
|
||||
# (default: disabled)
|
||||
#
|
||||
# fullscreen=false
|
||||
|
||||
|
||||
# Preserve game screen aspect ratio,
|
||||
# as opposed to stretch-to-fill
|
||||
# (default: enabled)
|
||||
#
|
||||
# fixedAspectRatio=true
|
||||
|
||||
|
||||
# Apply linear interpolation when game screen
|
||||
# is upscaled
|
||||
# (default: disabled)
|
||||
#
|
||||
# smoothScaling=false
|
||||
|
||||
|
||||
# Sync screen redraws to the monitor refresh rate
|
||||
# (default: disabled)
|
||||
#
|
||||
# vsync=false
|
||||
|
||||
|
||||
# Specify the window width on startup. If set to 0,
|
||||
# it will default to the default resolution width
|
||||
# specific to the RGSS version (640 in RGSS1, 544
|
||||
# in RGSS2 or higher).
|
||||
# (default: 0)
|
||||
#
|
||||
# defScreenW=640
|
||||
|
||||
|
||||
# Specify the window height on startup. If set to 0,
|
||||
# it will default to the default resolution height
|
||||
# specific to the RGSS version (480 in RGSS1, 416
|
||||
# in RGSS2 or higher).
|
||||
# (default: 0)
|
||||
#
|
||||
# defScreenH=480
|
||||
|
||||
|
||||
# Override the game window title
|
||||
# (default: none)
|
||||
#
|
||||
# windowTitle=Custom Title
|
||||
|
||||
|
||||
# Enforce a static frame rate
|
||||
# This option may be force-disabled at build time.
|
||||
# (0 = disabled)
|
||||
#
|
||||
# fixedFramerate=0
|
||||
|
||||
|
||||
# Skip (don't draw) frames when behind
|
||||
# (default: disabled)
|
||||
#
|
||||
# frameSkip=false
|
||||
|
||||
|
||||
# Use a fixed framerate that is approx. equal to the
|
||||
# native screen refresh rate. This is different from
|
||||
# "fixedFramerate" because the actual frame rate is
|
||||
# reported back to the game, ensuring correct timers.
|
||||
# If the screen refresh rate cannot be determined,
|
||||
# this option is force-disabled.
|
||||
# This option may be force-disabled at build time.
|
||||
# (default: disabled)
|
||||
#
|
||||
# syncToRefreshrate=false
|
||||
|
||||
|
||||
# Don't use alpha blending when rendering text
|
||||
# (default: disabled)
|
||||
#
|
||||
# solidFonts=false
|
||||
|
||||
|
||||
# Work around buggy graphics drivers which don't
|
||||
# properly synchronize texture access, most
|
||||
# apparent when text doesn't show up or the map
|
||||
# tileset doesn't render at all
|
||||
# (default: disabled)
|
||||
#
|
||||
# subImageFix=false
|
||||
|
||||
|
||||
# Enable framebuffer blitting if the driver is
|
||||
# capable of it. Some drivers carry buggy
|
||||
# implementations of this functionality, so
|
||||
# disabling it can be used as a workaround
|
||||
# (default: enabled)
|
||||
#
|
||||
# enableBlitting=true
|
||||
|
||||
|
||||
# Limit the maximum size (width, height) of
|
||||
# most textures mkxp will create (exceptions are
|
||||
# rendering backbuffers and similar).
|
||||
# If set to 0, the hardware maximum is used.
|
||||
# This is useful for recording traces that can
|
||||
# be played back on machines with lower specs.
|
||||
# (default: 0)
|
||||
#
|
||||
# maxTextureSize=0
|
||||
|
||||
|
||||
# Set the base path of the game to '/path/to/game'
|
||||
# (default: executable directory)
|
||||
#
|
||||
# gameFolder=/path/to/game
|
||||
|
||||
|
||||
# Use either right or left Alt + Enter to toggle
|
||||
# fullscreen
|
||||
# (default: disabled)
|
||||
#
|
||||
# anyAltToggleFS=false
|
||||
|
||||
|
||||
# Enable F12 game reset
|
||||
# (default: enabled)
|
||||
#
|
||||
# enableReset=true
|
||||
|
||||
|
||||
# Allow symlinks for game assets to be followed
|
||||
# (default: disabled)
|
||||
#
|
||||
# allowSymlinks=false
|
||||
|
||||
|
||||
# Organisation / company and application / game
|
||||
# name to build the directory path where mkxp
|
||||
# will store game specific data (eg. key bindings).
|
||||
# If not specified, mkxp will choose the game's name
|
||||
# as set in its ini. Note that these are TWO individual
|
||||
# config entries, and both need to be defined for this
|
||||
# to take effect.
|
||||
# (default: none)
|
||||
#
|
||||
# dataPathOrg=mycompany
|
||||
# dataPathApp=mygame
|
||||
|
||||
|
||||
# Set the game window icon to 'path/to/icon.png'
|
||||
# (default: none)
|
||||
#
|
||||
# iconPath=/path/to/icon.png
|
||||
|
||||
|
||||
# Instead of playing an RPG Maker game,
|
||||
# execute a single plain text script instead
|
||||
# (default: none)
|
||||
#
|
||||
# customScript=/path/to/script.rb
|
||||
|
||||
|
||||
# Define raw scripts to be executed before the
|
||||
# actual Scripts.rxdata execution starts
|
||||
# This option may be force-disabled at build time.
|
||||
# (default: none)
|
||||
#
|
||||
# preloadScript=my_win32_wrapper.rb
|
||||
# preloadScript=ruby18_fixes.rb
|
||||
|
||||
|
||||
# Index all accesible assets via their lower case path
|
||||
# (emulates windows case insensitivity)
|
||||
# (default: enabled)
|
||||
#
|
||||
# pathCache=true
|
||||
|
||||
|
||||
# Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
|
||||
# asset search path (multiple allowed)
|
||||
# (default: none)
|
||||
#
|
||||
# RTP=/path/to/rtp1
|
||||
# RTP=/path/to/rtp2.zip
|
||||
# RTP=/path/to/game.rgssad
|
||||
|
||||
|
||||
# Use the script's name as filename in warnings and error messages
|
||||
# (default: enabled)
|
||||
#
|
||||
# useScriptNames=true
|
||||
|
||||
|
||||
# Font substitutions allow drop-in replacements of fonts
|
||||
# to be used without changing the RGSS scripts,
|
||||
# eg. providing 'Open Sans' when the game thinkgs it's
|
||||
# using 'Arial'. Font family to be substituted and
|
||||
# replacement family are separated by one sole '>'.
|
||||
# Be careful not to include any spaces.
|
||||
# This is not connected to the built-in font, which is
|
||||
# always used when a non-existing font family is
|
||||
# requested by RGSS.
|
||||
# (default: none)
|
||||
#
|
||||
# fontSub=Arial>Open Sans
|
||||
# fontSub=Times New Roman>Liberation Serif
|
||||
|
||||
|
||||
# Because mkxp is usually distributed as a stand alone
|
||||
# build, no predefined load paths are initialized
|
||||
# ($:, $LOAD_PATH) in the MRI backend. With this option,
|
||||
# they can be specified manually (eg. when using a system
|
||||
# libruby.so). It is however recommended to statically
|
||||
# link all required gems into libruby.so.
|
||||
# (default: none)
|
||||
#
|
||||
# rubyLoadpath=/usr/lib64/ruby/
|
||||
# rubyLoadpath=/usr/local/share/ruby/site_ruby
|
||||
|
||||
|
||||
# SoundFont to use for midi playback (via fluidsynth)
|
||||
# (default: none)
|
||||
#
|
||||
# midi.soundFont=/usr/share/mysoundfont.sf2
|
||||
|
||||
|
||||
# Activate "chorus" effect for midi playback
|
||||
#
|
||||
# midi.chorus=false
|
||||
|
||||
|
||||
# Activate "reverb" effect for midi playback
|
||||
#
|
||||
# midi.reverb=false
|
||||
|
||||
|
||||
# Number of OpenAL sources to allocate for SE playback.
|
||||
# If there are a lot of sounds playing at the same time
|
||||
# and audibly cutting each other off, try increasing
|
||||
# this number. Maximum: 64.
|
||||
#
|
||||
# SE.sourceCount=6
|
||||
|
||||
|
||||
# The Windows game executable name minus ".exe". By default
|
||||
# this is "Game", but some developers manually rename it.
|
||||
# mkxp needs this name because both the .ini (game
|
||||
# configuration) and .rgssad (encrypted data archive) must
|
||||
# carry the same name minus their extension, and we cannot
|
||||
# guess the executable's name.
|
||||
# You could just as well rename them both to "Game.ini" and
|
||||
# "Game.rgssad", but specifying the executable name here
|
||||
# is a tiny bit less intrusive.
|
||||
#
|
||||
# execName=Game
|
||||
|
||||
|
||||
# Give a hint on which language the game title as
|
||||
# specified in the Game.ini is, useful if the encoding
|
||||
# is being falsely detected. Relevant only if mkxp was
|
||||
# built with automatic encoding conversion (INI_ENCODING).
|
||||
# (default: none)
|
||||
#
|
||||
# titleLanguage=japanese
|
||||
|
||||
|
||||
|
||||
# The Discord Client ID for your application. If left undefined,
|
||||
# mkxp-z's Client ID is used by default.
|
||||
# Only has an effect if mkxp-z is built with Discord support.
|
||||
#
|
||||
# discordClientId=1234567890
|
308
mkxp.json.sample
Normal file
308
mkxp.json.sample
Normal file
|
@ -0,0 +1,308 @@
|
|||
{
|
||||
// Lines starting with '//' are comments.
|
||||
//
|
||||
// About filesystem paths specified in this config:
|
||||
// The "gameFolder" path is resolved either relative
|
||||
// to the directory containing the mkxp executable
|
||||
// (the default behavior), or relative to the current
|
||||
// working directory (when compiled with
|
||||
// -DWORKDIR_CURRENT). All other paths are resolved
|
||||
// relative to gameFolder and ignoring both RTPs and
|
||||
// encrypted archives.
|
||||
|
||||
|
||||
// Specify the RGSS version to run under.
|
||||
// Possible values are 0, 1, 2, 3. If set to 0,
|
||||
// mkxp will try to guess the required version
|
||||
// based on the game files found in gameFolder.
|
||||
// If this fails, the version defaults to 1.
|
||||
// (default: 0)
|
||||
//
|
||||
// "rgssVersion": 1,
|
||||
|
||||
|
||||
// Create a debug context and log
|
||||
// OpenGL debug information to the console
|
||||
// (default: disabled)
|
||||
//
|
||||
// "debugMode": false,
|
||||
|
||||
|
||||
// Continuously print average FPS to console.
|
||||
// This setting does not affect the window title
|
||||
// FPS display toggled via F2
|
||||
// (default: disabled)
|
||||
//
|
||||
// "printFPS": false,
|
||||
|
||||
|
||||
// Game window is resizable
|
||||
// (default: enabled)
|
||||
//
|
||||
// "winResizable": true,
|
||||
|
||||
|
||||
// Start game in fullscreen (this can
|
||||
// always be toggled with Alt-Enter at runtime)
|
||||
// (default: disabled)
|
||||
//
|
||||
// "fullscreen": false,
|
||||
|
||||
|
||||
// Preserve game screen aspect ratio,
|
||||
// as opposed to stretch-to-fill
|
||||
// (default: enabled)
|
||||
//
|
||||
// "fixedAspectRatio": true,
|
||||
|
||||
|
||||
// Apply linear interpolation when game screen
|
||||
// is upscaled
|
||||
// (default: disabled)
|
||||
//
|
||||
// "smoothScaling": false,
|
||||
|
||||
|
||||
// Sync screen redraws to the monitor refresh rate
|
||||
// (default: disabled)
|
||||
//
|
||||
// "vsync": false,
|
||||
|
||||
|
||||
// Specify the window width on startup. If set to 0,
|
||||
// it will default to the default resolution width
|
||||
// specific to the RGSS version (640 in RGSS1, 544
|
||||
// in RGSS2 or higher).
|
||||
// (default: 0)
|
||||
//
|
||||
// "defScreenW": 640,
|
||||
|
||||
|
||||
// Specify the window height on startup. If set to 0,
|
||||
// it will default to the default resolution height
|
||||
// specific to the RGSS version (480 in RGSS1, 416
|
||||
// in RGSS2 or higher).
|
||||
// (default: 0)
|
||||
//
|
||||
// "defScreenH": 480,
|
||||
|
||||
|
||||
// Override the game window title
|
||||
// (default: none)
|
||||
//
|
||||
// "windowTitle": "Custom Title",
|
||||
|
||||
|
||||
// Enforce a static frame rate
|
||||
// This option may be force-disabled at build time.
|
||||
// (0 = disabled)
|
||||
//
|
||||
// "fixedFramerate": 0,
|
||||
|
||||
|
||||
// Skip (don't draw) frames when behind
|
||||
// (default: disabled)
|
||||
//
|
||||
// "frameSkip": false,
|
||||
|
||||
|
||||
// Use a fixed framerate that is approx. equal to the
|
||||
// native screen refresh rate. This is different from
|
||||
// "fixedFramerate" because the actual frame rate is
|
||||
// reported back to the game, ensuring correct timers.
|
||||
// If the screen refresh rate cannot be determined,
|
||||
// this option is force-disabled.
|
||||
// This option may be force-disabled at build time.
|
||||
// (default: disabled)
|
||||
//
|
||||
// "syncToRefreshrate": false,
|
||||
|
||||
|
||||
// Don't use alpha blending when rendering text
|
||||
// (default: disabled)
|
||||
//
|
||||
// "solidFonts": false,
|
||||
|
||||
|
||||
// Work around buggy graphics drivers which don't
|
||||
// properly synchronize texture access, most
|
||||
// apparent when text doesn't show up or the map
|
||||
// tileset doesn't render at all
|
||||
// (default: disabled)
|
||||
//
|
||||
// "subImageFix": false,
|
||||
|
||||
|
||||
// Enable framebuffer blitting if the driver is
|
||||
// capable of it. Some drivers carry buggy
|
||||
// implementations of this functionality, so
|
||||
// disabling it can be used as a workaround
|
||||
// (default: enabled)
|
||||
//
|
||||
// "enableBlitting": true,
|
||||
|
||||
|
||||
// Limit the maximum size (width, height) of
|
||||
// most textures mkxp will create (exceptions are
|
||||
// rendering backbuffers and similar).
|
||||
// If set to 0, the hardware maximum is used.
|
||||
// This is useful for recording traces that can
|
||||
// be played back on machines with lower specs.
|
||||
// (default: 0)
|
||||
//
|
||||
// "maxTextureSize": 0,
|
||||
|
||||
|
||||
// Set the base path of the game to '/path/to/game'
|
||||
// (default: executable directory)
|
||||
//
|
||||
// "gameFolder": "/path/to/game",
|
||||
|
||||
|
||||
// Use either right or left Alt + Enter to toggle
|
||||
// fullscreen
|
||||
// (default: disabled)
|
||||
//
|
||||
// "anyAltToggleFS": false,
|
||||
|
||||
|
||||
// Enable F12 game reset
|
||||
// (default: enabled)
|
||||
//
|
||||
// "enableReset": true,
|
||||
|
||||
|
||||
// Allow symlinks for game assets to be followed
|
||||
// (default: disabled)
|
||||
//
|
||||
// "allowSymlinks": false,
|
||||
|
||||
|
||||
// Organisation / company and application / game
|
||||
// name to build the directory path where mkxp
|
||||
// will store game specific data (eg. key bindings).
|
||||
// If not specified, mkxp will save to a common
|
||||
// directory shared by all games. Note that these
|
||||
// are TWO individual config entries, and both need
|
||||
// to be defined for this to take effect.
|
||||
// (default: none)
|
||||
//
|
||||
// "dataPathOrg": "mycompany",
|
||||
// "dataPathApp": "mygame",
|
||||
|
||||
|
||||
// Set the game window icon to 'path/to/icon.png'
|
||||
// (default: none)
|
||||
//
|
||||
// "iconPath": "/path/to/icon.png",
|
||||
|
||||
|
||||
// Instead of playing an RPG Maker game,
|
||||
// execute a single plain text script instead
|
||||
// (default: none)
|
||||
//
|
||||
// "customScript": "/path/to/script.rb",
|
||||
|
||||
|
||||
// Define raw scripts to be executed before the
|
||||
// actual Scripts.rxdata execution starts
|
||||
// This option may be force-disabled at build time.
|
||||
// (default: none)
|
||||
//
|
||||
// "preloadScript": ["my_win32_wrapper.rb",
|
||||
// "ruby18_fixes.rb"],
|
||||
|
||||
|
||||
// Index all accesible assets via their lower case path
|
||||
// (emulates windows case insensitivity)
|
||||
// (default: enabled)
|
||||
//
|
||||
// "pathCache": true,
|
||||
|
||||
|
||||
// Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
|
||||
// asset search path (multiple allowed)
|
||||
// (default: none)
|
||||
//
|
||||
// "RTP": ["/path/to/rtp1",
|
||||
// "/path/to/rtp2.zip",
|
||||
// "/path/to/game.rgssad"],
|
||||
|
||||
|
||||
// Use the script's name as filename in warnings and error messages
|
||||
// (default: enabled)
|
||||
//
|
||||
// "useScriptNames": true,
|
||||
|
||||
|
||||
// Font substitutions allow drop-in replacements of fonts
|
||||
// to be used without changing the RGSS scripts,
|
||||
// eg. providing 'Open Sans' when the game thinkgs it's
|
||||
// using 'Arial'. Font family to be substituted and
|
||||
// replacement family are separated by one sole '>'.
|
||||
// Be careful not to include any spaces.
|
||||
// This is not connected to the built-in font, which is
|
||||
// always used when a non-existing font family is
|
||||
// requested by RGSS.
|
||||
// (default: none)
|
||||
//
|
||||
// "fontSub": ["Arial>Open Sans",
|
||||
// "Times New Roman>Liberation Serif"]
|
||||
|
||||
|
||||
// Because mkxp is usually distributed as a stand alone
|
||||
// build, no predefined load paths are initialized
|
||||
// ($:, $LOAD_PATH) in the MRI backend. With this option,
|
||||
// they can be specified manually (eg. when using a system
|
||||
// libruby.so). It is however recommended to statically
|
||||
// link all required gems into libruby.so.
|
||||
// (default: none)
|
||||
//
|
||||
// "rubyLoadpath": ["/usr/lib64/ruby/",
|
||||
// "/usr/local/share/ruby/site_ruby]"],
|
||||
|
||||
|
||||
// SoundFont to use for midi playback (via fluidsynth)
|
||||
// (default: none)
|
||||
//
|
||||
"midiSoundFont": "Audio/BGM/GMGSx.sf2",
|
||||
|
||||
|
||||
// Activate "chorus" effect for midi playback
|
||||
//
|
||||
// midi."chorus": false
|
||||
|
||||
|
||||
// Activate "reverb" effect for midi playback
|
||||
//
|
||||
// midi."reverb": false
|
||||
|
||||
|
||||
// Number of OpenAL sources to allocate for SE playback.
|
||||
// If there are a lot of sounds playing at the same time
|
||||
// and audibly cutting each other off, try increasing
|
||||
// this number. Maximum: 64.
|
||||
//
|
||||
// SE."sourceCount": 6
|
||||
|
||||
|
||||
// The Windows game executable name minus ".exe". By default
|
||||
// this is "Game", but some developers manually rename it.
|
||||
// mkxp needs this name because both the .ini (game
|
||||
// configuration) and .rgssad (encrypted data archive) must
|
||||
// carry the same name minus their extension, and we cannot
|
||||
// guess the executable's name.
|
||||
// You could just as well rename them both to "Game.ini" and
|
||||
// "Game.rgssad", but specifying the executable name here
|
||||
// is a tiny bit less intrusive.
|
||||
//
|
||||
// "execName": "Game",
|
||||
|
||||
|
||||
// The Discord Client ID for your application. If left undefined,
|
||||
// mkxp-z's Client ID is used by default.
|
||||
// Only has an effect if mkxp-z is built with Discord support.
|
||||
//
|
||||
// "discordClientId": 1234567890
|
||||
|
||||
}
|
|
@ -89,7 +89,7 @@ struct Config
|
|||
#endif
|
||||
|
||||
std::string customScript;
|
||||
std::set<std::string> preloadScripts;
|
||||
std::vector<std::string> preloadScripts;
|
||||
std::vector<std::string> rtps;
|
||||
|
||||
std::vector<std::string> fontSubs;
|
||||
|
|
343
src/config.mm
343
src/config.mm
|
@ -1,36 +1,9 @@
|
|||
/*
|
||||
** config.cpp
|
||||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp 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 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <ObjFW/ObjFW.h>
|
||||
|
||||
#import <SDL_filesystem.h>
|
||||
#import "config.h"
|
||||
|
||||
#import <boost/program_options/options_description.hpp>
|
||||
#import <boost/program_options/parsers.hpp>
|
||||
#import <boost/program_options/variables_map.hpp>
|
||||
|
||||
#import <SDL_filesystem.h>
|
||||
|
||||
#import <fstream>
|
||||
#import <stdint.h>
|
||||
#import <vector>
|
||||
|
||||
#import "debugwriter.h"
|
||||
#import "util.h"
|
||||
|
@ -41,173 +14,176 @@
|
|||
#import "discordstate.h"
|
||||
#endif
|
||||
|
||||
static std::string prefPath(const char *org, const char *app)
|
||||
OFString* prefPath(const char* org, const char* app)
|
||||
{
|
||||
char *path = SDL_GetPrefPath(org, app);
|
||||
|
||||
if (!path)
|
||||
return std::string();
|
||||
|
||||
std::string str(path);
|
||||
SDL_free(path);
|
||||
|
||||
return str;
|
||||
char* path = SDL_GetPrefPath(org, app);
|
||||
if (!path)
|
||||
return [OFString string];
|
||||
|
||||
OFString* str = [OFString stringWithUTF8String:path];
|
||||
SDL_free(path);
|
||||
return str;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::set<T> setFromVec(const std::vector<T> &vec)
|
||||
void fillStringVec(id array, std::vector<std::string>& vector)
|
||||
{
|
||||
return std::set<T>(vec.begin(), vec.end());
|
||||
if (![array isKindOfClass:[OFArray class]])
|
||||
{
|
||||
if ([array isKindOfClass:[OFString class]])
|
||||
vector.push_back(std::string([array UTF8String]));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OFEnumerator* e = [array objectEnumerator];
|
||||
@autoreleasepool{
|
||||
for (id obj = [e nextObject]; obj != nil; obj = [e nextObject])
|
||||
{
|
||||
if (![obj isKindOfClass:[OFString class]])
|
||||
continue;
|
||||
|
||||
vector.push_back(std::string([obj UTF8String]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::vector<std::string> StringVec;
|
||||
namespace po = boost::program_options;
|
||||
#define CONF_FILE "mkxp.json"
|
||||
|
||||
#define CONF_FILE "mkxp.conf"
|
||||
|
||||
Config::Config()
|
||||
{}
|
||||
Config::Config() {}
|
||||
|
||||
void Config::read(int argc, char *argv[])
|
||||
{
|
||||
#define PO_DESC_ALL \
|
||||
PO_DESC(rgssVersion, int, 0) \
|
||||
PO_DESC(debugMode, bool, false) \
|
||||
PO_DESC(printFPS, bool, false) \
|
||||
PO_DESC(winResizable, bool, true) \
|
||||
PO_DESC(fullscreen, bool, false) \
|
||||
PO_DESC(fixedAspectRatio, bool, true) \
|
||||
PO_DESC(smoothScaling, bool, false) \
|
||||
PO_DESC(vsync, bool, false) \
|
||||
PO_DESC(defScreenW, int, 0) \
|
||||
PO_DESC(defScreenH, int, 0) \
|
||||
PO_DESC(windowTitle, std::string, "") \
|
||||
PO_DESC(fixedFramerate, int, 0) \
|
||||
PO_DESC(frameSkip, bool, false) \
|
||||
PO_DESC(syncToRefreshrate, bool, false) \
|
||||
PO_DESC(solidFonts, bool, false) \
|
||||
PO_DESC(subImageFix, bool, false) \
|
||||
PO_DESC(enableBlitting, bool, true) \
|
||||
PO_DESC(maxTextureSize, int, 0) \
|
||||
PO_DESC(gameFolder, std::string, ".") \
|
||||
PO_DESC(anyAltToggleFS, bool, false) \
|
||||
PO_DESC(enableReset, bool, true) \
|
||||
PO_DESC(allowSymlinks, bool, false) \
|
||||
PO_DESC(dataPathOrg, std::string, "") \
|
||||
PO_DESC(dataPathApp, std::string, "") \
|
||||
PO_DESC(iconPath, std::string, "") \
|
||||
PO_DESC(execName, std::string, "Game") \
|
||||
PO_DESC(titleLanguage, std::string, "") \
|
||||
PO_DESC(midi.soundFont, std::string, "") \
|
||||
PO_DESC(midi.chorus, bool, false) \
|
||||
PO_DESC(midi.reverb, bool, false) \
|
||||
PO_DESC(SE.sourceCount, int, 6) \
|
||||
PO_DESC(customScript, std::string, "") \
|
||||
PO_DESC(pathCache, bool, true) \
|
||||
PO_DESC(useScriptNames, bool, true)
|
||||
|
||||
// Not gonna take your shit boost
|
||||
#define GUARD_ALL( exp ) try { exp } catch(...) {}
|
||||
#define GUARD_ALL_OBJ( exp ) @try { exp } @catch(...) {}
|
||||
|
||||
editor.debug = false;
|
||||
editor.battleTest = false;
|
||||
|
||||
/* Read arguments sent from the editor */
|
||||
if (argc > 1)
|
||||
{
|
||||
std::string argv1 = argv[1];
|
||||
/* RGSS1 uses "debug", 2 and 3 use "test" */
|
||||
if (argv1 == "debug" || argv1 == "test")
|
||||
editor.debug = true;
|
||||
else if (argv1 == "btest")
|
||||
editor.battleTest = true;
|
||||
|
||||
/* Fix offset */
|
||||
if (editor.debug || editor.battleTest)
|
||||
{
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
#define PO_DESC(key, type, def) (#key, po::value< type >()->default_value(def))
|
||||
|
||||
po::options_description podesc;
|
||||
podesc.add_options()
|
||||
PO_DESC_ALL
|
||||
OFMutableDictionary* opts = [OFMutableDictionary dictionaryWithDictionary:@{
|
||||
@"rgssVersion": @0,
|
||||
@"debugMode": @false,
|
||||
@"printFPS": @false,
|
||||
@"winResizable": @true,
|
||||
@"fullscreen": @false,
|
||||
@"fixedAspectRatio": @true,
|
||||
@"smoothScaling": @false,
|
||||
@"vsync": @false,
|
||||
@"defScreenW": @0,
|
||||
@"defScreenH": @0,
|
||||
@"windowTitle": @"",
|
||||
@"fixedFramerate": @false,
|
||||
@"frameSkip": @false,
|
||||
@"syncToRefreshRate": @false,
|
||||
@"solidFonts": @false,
|
||||
@"subImageFix": @false,
|
||||
@"enableBlitting": @true,
|
||||
@"maxTextureSize": @0,
|
||||
@"gameFolder": @".",
|
||||
@"anyAltToggleFS": @false,
|
||||
@"enableReset": @true,
|
||||
@"allowSymlinks": @false,
|
||||
@"dataPathOrg": @"",
|
||||
@"dataPathApp": @"",
|
||||
@"iconPath": @"",
|
||||
@"execName": @"Game",
|
||||
@"midiSoundFont": @"",
|
||||
@"midiChorus": @false,
|
||||
@"midiReverb": @false,
|
||||
@"SESourceCount": @6,
|
||||
@"customScript": @"",
|
||||
@"pathCache": @true,
|
||||
#ifdef HAVE_DISCORDSDK
|
||||
PO_DESC(discordClientId, DiscordClientId, DEFAULT_CLIENT_ID)
|
||||
@"discordClientId": @DEFAULT_CLIENT_ID,
|
||||
#endif
|
||||
("preloadScript", po::value<StringVec>()->composing())
|
||||
("RTP", po::value<StringVec>()->composing())
|
||||
("fontSub", po::value<StringVec>()->composing())
|
||||
("rubyLoadpath", po::value<StringVec>()->composing())
|
||||
;
|
||||
@"useScriptNames": @1,
|
||||
@"preloadScript": @[],
|
||||
@"RTP": @[],
|
||||
@"fontSub": @[],
|
||||
@"rubyLoadpath": @[]
|
||||
}];
|
||||
|
||||
po::variables_map vm;
|
||||
#define GUARD( exp ) @try { exp } @catch(...) {}
|
||||
|
||||
/* Parse command line options */
|
||||
try
|
||||
{
|
||||
po::parsed_options cmdPo =
|
||||
po::command_line_parser(argc, argv).options(podesc).run();
|
||||
po::store(cmdPo, vm);
|
||||
}
|
||||
catch (po::error &error)
|
||||
{
|
||||
Debug() << "Command line:" << error.what();
|
||||
}
|
||||
editor.debug = false;
|
||||
editor.battleTest = false;
|
||||
|
||||
/* Parse configuration file */
|
||||
SDLRWStream confFile(CONF_FILE, "r");
|
||||
if (argc > 1)
|
||||
{
|
||||
OFString* argv1 = [OFString stringWithUTF8String:argv[1]];
|
||||
if ([argv1 isEqual: @"debug"] || [argv1 isEqual: @"test"])
|
||||
editor.debug = true;
|
||||
else if ([argv1 isEqual: @"btest"])
|
||||
editor.battleTest = true;
|
||||
}
|
||||
|
||||
if (confFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
po::store(po::parse_config_file(confFile.stream(), podesc, true), vm);
|
||||
po::notify(vm);
|
||||
}
|
||||
catch (po::error &error)
|
||||
{
|
||||
Debug() << CONF_FILE":" << error.what();
|
||||
}
|
||||
}
|
||||
if ([[OFFileManager defaultManager] fileExistsAtPath:@CONF_FILE])
|
||||
{
|
||||
@autoreleasepool{
|
||||
@try {
|
||||
id confData = [
|
||||
[OFString
|
||||
stringWithContentsOfFile:@CONF_FILE
|
||||
encoding: OF_STRING_ENCODING_UTF_8
|
||||
] JSONValue];
|
||||
|
||||
if (![confData isKindOfClass:[OFDictionary class]])
|
||||
{
|
||||
confData = @{};
|
||||
}
|
||||
|
||||
#undef PO_DESC
|
||||
#define PO_DESC(key, type, def) GUARD_ALL( key = vm[#key].as< type >(); )
|
||||
OFEnumerator* e = [confData keyEnumerator];
|
||||
for (id key = [e nextObject]; key != nil; key = [e nextObject])
|
||||
{
|
||||
Debug() << [[key description] UTF8String] << [[key className] UTF8String];
|
||||
opts[key] = confData[key];
|
||||
}
|
||||
}
|
||||
@catch(OFException *e){
|
||||
Debug() << [[e description] UTF8String];
|
||||
}
|
||||
}
|
||||
#define SET_OPT_CUSTOMKEY(var, key, type) GUARD( var = [opts[@#key] type]; )
|
||||
#define SET_OPT(var, type) SET_OPT_CUSTOMKEY(var, var, type)
|
||||
#define SET_STRINGOPT(var, key) GUARD( var = std::string([opts[@#key] UTF8String]); )
|
||||
}
|
||||
SET_OPT(rgssVersion, intValue);
|
||||
SET_OPT(debugMode, boolValue);
|
||||
SET_OPT(printFPS, boolValue);
|
||||
SET_OPT(winResizable, boolValue);
|
||||
SET_OPT(fullscreen, boolValue);
|
||||
SET_OPT(fixedAspectRatio, boolValue);
|
||||
SET_OPT(smoothScaling, boolValue);
|
||||
SET_OPT(vsync, boolValue);
|
||||
SET_OPT(defScreenW, intValue);
|
||||
SET_OPT(defScreenH, intValue);
|
||||
SET_STRINGOPT(windowTitle, windowTitle);
|
||||
SET_OPT(fixedFramerate, intValue);
|
||||
SET_OPT(frameSkip, boolValue);
|
||||
SET_OPT(syncToRefreshrate, boolValue);
|
||||
SET_OPT(solidFonts, boolValue);
|
||||
SET_OPT(subImageFix, boolValue);
|
||||
SET_OPT(enableBlitting, boolValue);
|
||||
SET_OPT(maxTextureSize, intValue);
|
||||
SET_STRINGOPT(gameFolder, gameFolder);
|
||||
SET_OPT(anyAltToggleFS, boolValue);
|
||||
SET_OPT(enableReset, boolValue);
|
||||
SET_OPT(allowSymlinks, boolValue);
|
||||
SET_STRINGOPT(dataPathOrg, dataPathOrg);
|
||||
SET_STRINGOPT(dataPathApp, dataPathApp);
|
||||
SET_STRINGOPT(iconPath, iconPath);
|
||||
SET_STRINGOPT(execName, execName);
|
||||
SET_STRINGOPT(midi.soundFont, midiSoundFont);
|
||||
SET_OPT_CUSTOMKEY(midi.chorus, midiChorus, boolValue);
|
||||
SET_OPT_CUSTOMKEY(midi.reverb, midiReverb, boolValue);
|
||||
SET_OPT_CUSTOMKEY(SE.sourceCount, SESourceCount, intValue);
|
||||
SET_STRINGOPT(customScript, customScript);
|
||||
SET_OPT(pathCache, boolValue);
|
||||
SET_OPT(useScriptNames, boolValue);
|
||||
|
||||
PO_DESC_ALL;
|
||||
|
||||
fillStringVec(opts[@"preloadScript"], preloadScripts);
|
||||
fillStringVec(opts[@"RTP"], rtps);
|
||||
fillStringVec(opts[@"fontSub"], fontSubs);
|
||||
fillStringVec(opts[@"rubyLoadpath"], rubyLoadpaths);
|
||||
rgssVersion = clamp(rgssVersion, 0, 3);
|
||||
SE.sourceCount = clamp(SE.sourceCount, 1, 64);
|
||||
#ifdef HAVE_DISCORDSDK
|
||||
PO_DESC(discordClientId, DiscordClientId, DEFAULT_CLIENT_ID)
|
||||
#endif
|
||||
SET_OPT(discordClientId, longLongValue);
|
||||
#endif
|
||||
|
||||
GUARD_ALL( preloadScripts = setFromVec(vm["preloadScript"].as<StringVec>()); );
|
||||
|
||||
GUARD_ALL( rtps = vm["RTP"].as<StringVec>(); );
|
||||
|
||||
GUARD_ALL( fontSubs = vm["fontSub"].as<StringVec>(); );
|
||||
|
||||
GUARD_ALL( rubyLoadpaths = vm["rubyLoadpath"].as<StringVec>(); );
|
||||
|
||||
#undef PO_DESC
|
||||
#undef PO_DESC_ALL
|
||||
|
||||
rgssVersion = clamp(rgssVersion, 0, 3);
|
||||
|
||||
SE.sourceCount = clamp(SE.sourceCount, 1, 64);
|
||||
}
|
||||
|
||||
static std::string baseName(const std::string &path)
|
||||
{
|
||||
size_t pos = path.find_last_of("/\\");
|
||||
|
||||
if (pos == path.npos)
|
||||
return path;
|
||||
|
||||
return path.substr(pos + 1);
|
||||
}
|
||||
|
||||
static void setupScreenSize(Config &conf)
|
||||
|
@ -223,7 +199,8 @@ void Config::readGameINI()
|
|||
{
|
||||
if (!customScript.empty())
|
||||
{
|
||||
game.title = baseName(customScript);
|
||||
|
||||
game.title = [[[[OFString stringWithUTF8String:customScript.c_str()] pathComponents] componentsJoinedByString:@"/"] UTF8String];
|
||||
|
||||
if (rgssVersion == 0)
|
||||
rgssVersion = 1;
|
||||
|
@ -232,15 +209,14 @@ void Config::readGameINI()
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
OFString* iniFilename = [OFString stringWithFormat:@"%s.ini", execName.c_str()];
|
||||
if ([[OFFileManager defaultManager] fileExistsAtPath:iniFilename])
|
||||
{
|
||||
@try{
|
||||
OFINIFile* iniFile = [OFINIFile fileWithPath:iniFilename];
|
||||
OFINICategory* iniCat = [iniFile categoryForName:@"Game"];
|
||||
GUARD_ALL_OBJ( game.title = [[iniCat stringForKey:@"Title" defaultValue:@""] UTF8String]; )
|
||||
GUARD_ALL_OBJ( game.scripts = [[iniCat stringForKey:@"Scripts" defaultValue:@""] UTF8String]; )
|
||||
GUARD( game.title = [[iniCat stringForKey:@"Title" defaultValue:@""] UTF8String]; )
|
||||
GUARD( game.scripts = [[iniCat stringForKey:@"Scripts" defaultValue:@""] UTF8String]; )
|
||||
|
||||
strReplace(game.scripts, '\\', '/');
|
||||
}
|
||||
|
@ -301,9 +277,9 @@ void Config::readGameINI()
|
|||
}
|
||||
|
||||
if (!dataPathOrg.empty() && !dataPathApp.empty())
|
||||
customDataPath = prefPath(dataPathOrg.c_str(), dataPathApp.c_str());
|
||||
customDataPath = [prefPath(dataPathOrg.c_str(), dataPathApp.c_str()) UTF8String];
|
||||
|
||||
commonDataPath = prefPath(".", "mkxpz");
|
||||
commonDataPath = [prefPath(".", "mkxpz") UTF8String];
|
||||
|
||||
|
||||
if (rgssVersion == 0)
|
||||
|
@ -326,6 +302,5 @@ void Config::readGameINI()
|
|||
rgssVersion = 3;
|
||||
}
|
||||
}
|
||||
|
||||
setupScreenSize(*this);
|
||||
}
|
||||
}
|
|
@ -7,13 +7,11 @@ sdl2_ttf = dependency('SDL2_ttf')
|
|||
sdl2_image = dependency('SDL2_image')
|
||||
sdl_sound = dependency('SDL_sound')
|
||||
opengl = dependency('GL')
|
||||
|
||||
boost = dependency('boost', version: '>=1.49', modules: 'program_options')
|
||||
openal = dependency('openal')
|
||||
zlib = dependency('zlib')
|
||||
|
||||
global_include_dirs += include_directories('.')
|
||||
global_dependencies += [sigcxx, openal, opengl, boost, zlib, pixman, physfs, vorbisfile, sdl2, sdl2_ttf, sdl2_image, sdl_sound]
|
||||
global_dependencies += [sigcxx, openal, opengl, zlib, pixman, physfs, vorbisfile, sdl2, sdl2_ttf, sdl2_image, sdl_sound]
|
||||
if host_system == 'darwin'
|
||||
global_dependencies += compilers['cpp'].find_library('iconv')
|
||||
global_dependencies += dependency('Foundation')
|
||||
|
|
Loading…
Add table
Reference in a new issue