mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
add compressedGraphics and openGL4 runtime opts
This commit is contained in:
parent
b3a096fddb
commit
d0b0cae923
8 changed files with 146 additions and 105 deletions
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "sharedstate.h"
|
||||
#include "filesystem.h"
|
||||
#include "config.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef OLD_RUBY
|
||||
|
@ -174,33 +175,31 @@ RB_METHOD(kernelLoadData)
|
|||
RB_UNUSED_PARAM;
|
||||
|
||||
VALUE filename;
|
||||
VALUE raw;
|
||||
VALUE raw;
|
||||
rb_scan_args(argc, argv, "11", &filename, &raw);
|
||||
SafeStringValue(filename);
|
||||
|
||||
// There's gotta be an easier way to do this
|
||||
if (raw != Qnil && raw != Qtrue && raw != Qfalse)
|
||||
{
|
||||
rb_raise(rb_eTypeError, "load_data: second argument must be Boolean");
|
||||
}
|
||||
|
||||
// Until a faster method for getting RGSSAD data is
|
||||
// written (could just copy RMXP, keeping stuff in
|
||||
// memory and just passing char pointers can't be
|
||||
// that complicated), load_data is still too slow
|
||||
// to handle the overworld load_data assault
|
||||
VALUE isGraphicsFile = rb_funcall(filename,
|
||||
rb_intern("start_with?"),
|
||||
1,
|
||||
rb_str_new2("Graphics"));
|
||||
|
||||
if (isGraphicsFile == Qtrue)
|
||||
{
|
||||
VALUE f = rb_file_open_str(filename, "rb");
|
||||
VALUE ret = rb_funcall(f, rb_intern("read"), 0);
|
||||
rb_funcall(f, rb_intern("close"), 0);
|
||||
return ret;
|
||||
}
|
||||
SafeStringValue(filename);
|
||||
|
||||
// There's gotta be an easier way to do this
|
||||
if (raw != Qnil && raw != Qtrue && raw != Qfalse)
|
||||
{
|
||||
rb_raise(rb_eTypeError, "load_data: second argument must be Boolean");
|
||||
}
|
||||
|
||||
if (!shState->config().compressedGraphics)
|
||||
{
|
||||
VALUE isGraphicsFile = rb_funcall(filename,
|
||||
rb_intern("start_with?"),
|
||||
1,
|
||||
rb_str_new2("Graphics"));
|
||||
|
||||
if (isGraphicsFile == Qtrue)
|
||||
{
|
||||
VALUE f = rb_file_open_str(filename, "rb");
|
||||
VALUE ret = rb_funcall(f, rb_intern("read"), 0);
|
||||
rb_funcall(f, rb_intern("close"), 0);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return kernelLoadDataInt(RSTRING_PTR(filename), true, RTEST(raw));
|
||||
}
|
||||
|
||||
|
|
|
@ -89,14 +89,6 @@ if get_option('threaded_gl_init')
|
|||
global_args += '-DTHREADED_GLINIT'
|
||||
endif
|
||||
|
||||
# Mainly for virtual machines
|
||||
if get_option('gl3')
|
||||
global_args += ['-DZ_GL_MINOR=3','-DZ_GL_MAJOR=3']
|
||||
else
|
||||
global_args += ['-DZ_GL_MINOR=1','-DZ_GL_MAJOR=4']
|
||||
endif
|
||||
|
||||
|
||||
# Objectify our C
|
||||
global_args += run_command(objfw,'--cppflags').stdout().split()
|
||||
add_project_arguments(run_command(objfw,'--objcflags').stdout().split(), language:['objc','objcpp'])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
option('mri_version', type: 'string', value: '1.8', description: 'Version of MRI to link with')
|
||||
option('mk', type: 'boolean', value: false, description: 'Build to fit Marin\'s MK standard')
|
||||
option('console', type: 'boolean', value: true, description: 'Whether to debug information in the console')
|
||||
option('console', type: 'boolean', value: false, description: 'Whether to debug information in the console')
|
||||
option('macos_min_version', type: 'string', value: '10.12', description: 'Minimum macOS system version to support')
|
||||
option('threaded_gl_init', type: 'boolean', value: true, description: 'Init GL on secondary thread')
|
||||
option('gl3', type: 'boolean', value: false, description: 'Use OpenGL 3.3 instead of 4.1')
|
||||
|
|
|
@ -21,6 +21,20 @@
|
|||
// "rgssVersion": 1,
|
||||
|
||||
|
||||
// Request an OpenGL 4.1 context. This
|
||||
// introduces these minimum requirements
|
||||
// for GPUs:
|
||||
//
|
||||
// + NVIDIA 400 Series+
|
||||
// + AMD Radeon HD 5000+
|
||||
// + Intel HD Graphics 4000+
|
||||
//
|
||||
// If disabled, OpenGL 3.3 is used instead.
|
||||
// (default: enabled)
|
||||
//
|
||||
// "openGL4": true,
|
||||
|
||||
|
||||
// Create a debug context and log
|
||||
// OpenGL debug information to the console
|
||||
// (default: disabled)
|
||||
|
@ -219,6 +233,28 @@
|
|||
//
|
||||
// "pathCache": true,
|
||||
|
||||
// In some versions of Essentials, overworld code
|
||||
// requests the player's sprite texture from disk
|
||||
// at least once every frame. The damage this
|
||||
// causes is less perceptible in RPG Maker XP,
|
||||
// but MKXP's RGSSAD code is much slower and will
|
||||
// cause games to lag. Hard.
|
||||
//
|
||||
// I have no interest in fixing it, because:
|
||||
//
|
||||
// (A) I don't see any point in such frail encryption, and
|
||||
// (B) One can easily replicate load_data entirely in Ruby
|
||||
// (https://gist.github.com/inori-z/0800dbdc213b9936e0e81f64c9a98c4c)
|
||||
//
|
||||
// If you insist on using archives, you can use a
|
||||
// version of Essentials that isn't broken,
|
||||
// otherwise come up with your own solution
|
||||
// (there are many), or leave your Graphics files
|
||||
// loose and disable this option.
|
||||
// (default: false)
|
||||
//
|
||||
// "compressedGraphics": false,
|
||||
|
||||
|
||||
// Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
|
||||
// asset search path (multiple allowed)
|
||||
|
@ -259,7 +295,7 @@
|
|||
// (default: none)
|
||||
//
|
||||
// "rubyLoadpath": ["/usr/lib64/ruby/",
|
||||
// "/usr/local/share/ruby/site_ruby]"],
|
||||
// "/usr/local/share/ruby/site_ruby"],
|
||||
|
||||
|
||||
// SoundFont to use for midi playback (via fluidsynth)
|
||||
|
|
133
src/config.h
133
src/config.h
|
@ -22,100 +22,103 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#ifdef HAVE_DISCORDSDK
|
||||
#include <discord_game_sdk.h>
|
||||
#endif
|
||||
|
||||
struct Config
|
||||
{
|
||||
int rgssVersion;
|
||||
struct Config {
|
||||
int rgssVersion;
|
||||
|
||||
bool debugMode;
|
||||
bool printFPS;
|
||||
struct {
|
||||
char major;
|
||||
char minor;
|
||||
} glVersion;
|
||||
|
||||
bool winResizable;
|
||||
bool fullscreen;
|
||||
bool fixedAspectRatio;
|
||||
bool smoothScaling;
|
||||
bool vsync;
|
||||
bool debugMode;
|
||||
bool printFPS;
|
||||
|
||||
int defScreenW;
|
||||
int defScreenH;
|
||||
std::string windowTitle;
|
||||
bool winResizable;
|
||||
bool fullscreen;
|
||||
bool fixedAspectRatio;
|
||||
bool smoothScaling;
|
||||
bool vsync;
|
||||
|
||||
int fixedFramerate;
|
||||
bool frameSkip;
|
||||
bool syncToRefreshrate;
|
||||
int defScreenW;
|
||||
int defScreenH;
|
||||
std::string windowTitle;
|
||||
|
||||
bool solidFonts;
|
||||
int fixedFramerate;
|
||||
bool frameSkip;
|
||||
bool syncToRefreshrate;
|
||||
|
||||
bool subImageFix;
|
||||
bool enableBlitting;
|
||||
int maxTextureSize;
|
||||
bool solidFonts;
|
||||
|
||||
std::string gameFolder;
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
bool allowSymlinks;
|
||||
bool pathCache;
|
||||
bool subImageFix;
|
||||
bool enableBlitting;
|
||||
int maxTextureSize;
|
||||
|
||||
std::string dataPathOrg;
|
||||
std::string dataPathApp;
|
||||
std::string gameFolder;
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
bool allowSymlinks;
|
||||
bool pathCache;
|
||||
bool compressedGraphics;
|
||||
|
||||
std::string iconPath;
|
||||
std::string execName;
|
||||
std::string titleLanguage;
|
||||
std::string dataPathOrg;
|
||||
std::string dataPathApp;
|
||||
|
||||
struct
|
||||
{
|
||||
std::string soundFont;
|
||||
bool chorus;
|
||||
bool reverb;
|
||||
} midi;
|
||||
std::string iconPath;
|
||||
std::string execName;
|
||||
std::string titleLanguage;
|
||||
|
||||
struct
|
||||
{
|
||||
int sourceCount;
|
||||
} SE;
|
||||
struct {
|
||||
std::string soundFont;
|
||||
bool chorus;
|
||||
bool reverb;
|
||||
} midi;
|
||||
|
||||
struct {
|
||||
int sourceCount;
|
||||
} SE;
|
||||
|
||||
bool useScriptNames;
|
||||
|
||||
bool useScriptNames;
|
||||
|
||||
#ifdef HAVE_DISCORDSDK
|
||||
DiscordClientId discordClientId;
|
||||
DiscordClientId discordClientId;
|
||||
#endif
|
||||
|
||||
std::string customScript;
|
||||
std::vector<std::string> preloadScripts;
|
||||
std::vector<std::string> rtps;
|
||||
std::string customScript;
|
||||
std::vector<std::string> preloadScripts;
|
||||
std::vector<std::string> rtps;
|
||||
|
||||
std::vector<std::string> fontSubs;
|
||||
std::vector<std::string> fontSubs;
|
||||
|
||||
std::vector<std::string> rubyLoadpaths;
|
||||
std::vector<std::string> rubyLoadpaths;
|
||||
|
||||
/* Editor flags */
|
||||
struct {
|
||||
bool debug;
|
||||
bool battleTest;
|
||||
} editor;
|
||||
/* Editor flags */
|
||||
struct {
|
||||
bool debug;
|
||||
bool battleTest;
|
||||
} editor;
|
||||
|
||||
/* Game INI contents */
|
||||
struct {
|
||||
std::string scripts;
|
||||
std::string title;
|
||||
} game;
|
||||
/* Game INI contents */
|
||||
struct {
|
||||
std::string scripts;
|
||||
std::string title;
|
||||
} game;
|
||||
|
||||
/* Internal */
|
||||
std::string customDataPath;
|
||||
std::string commonDataPath;
|
||||
/* Internal */
|
||||
std::string customDataPath;
|
||||
std::string commonDataPath;
|
||||
|
||||
Config();
|
||||
Config();
|
||||
|
||||
void read(int argc, char *argv[]);
|
||||
void readGameINI();
|
||||
void read(int argc, char *argv[]);
|
||||
void readGameINI();
|
||||
};
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
|
|
@ -50,6 +50,7 @@ Config::Config() {}
|
|||
void Config::read(int argc, char *argv[]) {
|
||||
OFMutableDictionary *opts = @{
|
||||
@"rgssVersion" : @0,
|
||||
@"openGL4" : @true,
|
||||
@"debugMode" : @false,
|
||||
@"printFPS" : @false,
|
||||
@"winResizable" : @true,
|
||||
|
@ -81,6 +82,7 @@ void Config::read(int argc, char *argv[]) {
|
|||
@"SESourceCount" : @6,
|
||||
@"customScript" : @"",
|
||||
@"pathCache" : @true,
|
||||
@"compressedGraphics" : @false,
|
||||
#ifdef HAVE_DISCORDSDK
|
||||
@"discordClientId" : @DEFAULT_CLIENT_ID,
|
||||
#endif
|
||||
|
@ -167,6 +169,7 @@ void Config::read(int argc, char *argv[]) {
|
|||
SET_OPT_CUSTOMKEY(SE.sourceCount, SESourceCount, intValue);
|
||||
SET_STRINGOPT(customScript, customScript);
|
||||
SET_OPT(pathCache, boolValue);
|
||||
SET_OPT(compressedGraphics, boolValue);
|
||||
SET_OPT(useScriptNames, boolValue);
|
||||
|
||||
fillStringVec(opts[@"preloadScript"], preloadScripts);
|
||||
|
@ -175,6 +178,14 @@ void Config::read(int argc, char *argv[]) {
|
|||
fillStringVec(opts[@"rubyLoadpath"], rubyLoadpaths);
|
||||
rgssVersion = clamp(rgssVersion, 0, 3);
|
||||
SE.sourceCount = clamp(SE.sourceCount, 1, 64);
|
||||
|
||||
if ([opts[@"openGL4"] boolValue]) {
|
||||
glVersion.major = 4;
|
||||
glVersion.minor = 1;
|
||||
} else {
|
||||
glVersion.major = 3;
|
||||
glVersion.minor = 3;
|
||||
}
|
||||
#ifdef HAVE_DISCORDSDK
|
||||
SET_OPT(discordClientId, longLongValue);
|
||||
#endif
|
||||
|
@ -258,4 +269,4 @@ void Config::readGameINI() {
|
|||
}
|
||||
}
|
||||
setupScreenSize(*this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ void initGLFunctions()
|
|||
int glMinor = ver[2] - '0';
|
||||
|
||||
if (glMajor < Z_GL_MAJOR || glMinor < Z_GL_MINOR)
|
||||
throw EXC("Insufficient OpenGL version");
|
||||
throw EXC("OpenGL (ES) version >= 2.1 required");
|
||||
|
||||
if (gles)
|
||||
{
|
||||
|
|
|
@ -412,8 +412,8 @@ static SDL_GLContext initGL(SDL_Window *win, Config &conf,
|
|||
// Core profile enables OpenGL4 on macOS
|
||||
// Using OpenGL 4.1 requires a GPU with max texture size of 16384 or better
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, Z_GL_MAJOR);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, Z_GL_MINOR);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, conf.glVersion.major);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, conf.glVersion.minor);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
|
||||
glCtx = SDL_GL_CreateContext(win);
|
||||
|
|
Loading…
Add table
Reference in a new issue