Speed up load_data & remove encryptedGraphics setting

This commit is contained in:
Struma 2021-02-26 08:33:27 -05:00 committed by Roza
parent 286270b51e
commit 48a2393bb8
5 changed files with 3 additions and 27 deletions

View file

@ -137,7 +137,7 @@ RB_METHOD(fileIntPos) {
VALUE VALUE
kernelLoadDataInt(const char *filename, bool rubyExc, bool raw) { kernelLoadDataInt(const char *filename, bool rubyExc, bool raw) {
rb_gc_start(); //rb_gc_start();
VALUE port = fileIntForPath(filename, rubyExc); VALUE port = fileIntForPath(filename, rubyExc);
VALUE result; VALUE result;
@ -168,18 +168,7 @@ RB_METHOD(kernelLoadData) {
if (raw != Qnil && raw != Qtrue && raw != Qfalse) { if (raw != Qnil && raw != Qtrue && raw != Qfalse) {
rb_raise(rb_eTypeError, "load_data: second argument must be Boolean"); rb_raise(rb_eTypeError, "load_data: second argument must be Boolean");
} }
if (!shState->config().encryptedGraphics) {
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)); return kernelLoadDataInt(RSTRING_PTR(filename), true, RTEST(raw));
} }

View file

@ -220,18 +220,6 @@
// //
// "pathCache": true, // "pathCache": true,
// Whether to load graphics files from the game's .rgssad
// and any RTP locations, or places mounted with System.mount
//
// Disabling this can speed up old versions of Essentials
// *massively*, and even current versions by a large amount.
// Applies to any sort of RTP or archive, not just RGSS
// archives.
// (default: true)
//
// "encryptedGraphics": true,
// Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the // Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
// asset search path (multiple allowed) // asset search path (multiple allowed)
// (default: none) // (default: none)

View file

@ -205,7 +205,6 @@ try { exp } catch (...) {}
SET_OPT_CUSTOMKEY(SE.sourceCount, SESourceCount, integer); SET_OPT_CUSTOMKEY(SE.sourceCount, SESourceCount, integer);
SET_STRINGOPT(customScript, customScript); SET_STRINGOPT(customScript, customScript);
SET_OPT(pathCache, boolean); SET_OPT(pathCache, boolean);
SET_OPT(encryptedGraphics, boolean);
SET_OPT(useScriptNames, boolean); SET_OPT(useScriptNames, boolean);
SET_OPT_CUSTOMKEY(jit.enabled, JITEnable, boolean); SET_OPT_CUSTOMKEY(jit.enabled, JITEnable, boolean);
SET_OPT_CUSTOMKEY(jit.verboseLevel, JITVerboseLevel, integer); SET_OPT_CUSTOMKEY(jit.verboseLevel, JITVerboseLevel, integer);

View file

@ -57,7 +57,6 @@ struct Config {
bool enableReset; bool enableReset;
bool allowSymlinks; bool allowSymlinks;
bool pathCache; bool pathCache;
bool encryptedGraphics;
std::string dataPathOrg; std::string dataPathOrg;
std::string dataPathApp; std::string dataPathApp;

View file

@ -658,6 +658,7 @@ void FileSystem::openReadRaw(SDL_RWops &ops, const char *filename,
throw Exception(Exception::NoFileError, "%s", filename); throw Exception(Exception::NoFileError, "%s", filename);
initReadOps(handle, ops, freeOnClose); initReadOps(handle, ops, freeOnClose);
return;
} }
// RGSS normalizes paths for at least audio // RGSS normalizes paths for at least audio