From 1dc46695213db2f7819160bd4a376beabafd0c01 Mon Sep 17 00:00:00 2001 From: Murturtle <97775022+Murturtle@users.noreply.github.com> Date: Sun, 29 Sep 2024 02:40:43 -0700 Subject: [PATCH] Add pi optimizations --- injector.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/injector.js b/injector.js index c2418d0..ab8cae7 100644 --- a/injector.js +++ b/injector.js @@ -135,6 +135,19 @@ var main;(function(){` ); } ); + + if(globalThis.optimizePi){ + patchedFile = patchedFile.replaceAll( + /3\.1415927410125732 \/ 180/i, + "0.01745" + ); + + patchedFile = patchedFile.replaceAll( + /3\.1415927410125732/i, + "3.14159" + ); + } + const extractInstanceMethodRegex = /^[\t ]*function \S+?_\S+?_\S+?\((\$this)?/gm; // /^[\t ]*function \S+?_\S+?_\S+?\(\$this/gm const extractInstanceMethodFullNameRegex = /function (\S*?)\(/gm; // /function (\S*?)\(\$this/gm @@ -197,6 +210,8 @@ var main;(function(){` ); //Edge cases. sigh //Done: add support for static properties on classes with constructors like this: function nmcg_GuiMainMenu() { + + patchedFile = patchedFile.replaceAll( /function [a-z]+?_([a-zA-Z\$]+?)\(\) \{/gm, (match) => {