diff --git a/libraries/app/package.json b/libraries/app/package.json index 4bb3022..4e35b5c 100644 --- a/libraries/app/package.json +++ b/libraries/app/package.json @@ -8,7 +8,6 @@ ".": "./src/index.tsx" }, "dependencies": { - "@revenge-mod/debug": "workspace:*", "@revenge-mod/modules": "workspace:*", "@revenge-mod/patcher": "workspace:*", "@revenge-mod/utils": "workspace:*" diff --git a/libraries/app/src/index.tsx b/libraries/app/src/index.tsx index 78d2f02..bd6fd24 100644 --- a/libraries/app/src/index.tsx +++ b/libraries/app/src/index.tsx @@ -1,4 +1,3 @@ -import { recordTimestamp } from '@revenge-mod/debug' import { React, ReactNative } from '@revenge-mod/modules/common' import { findByName } from '@revenge-mod/modules/finders' import { BundleUpdaterManager } from '@revenge-mod/modules/native' @@ -38,12 +37,8 @@ const unpatchRunApplication = patcher.after( () => { unpatchRunApplication() - recordTimestamp('App_RunApplicationCalled') logger.log('AppRegistry.runApplication called') - for (const callback of initializeCallbacks) callback() - - recordTimestamp('App_AfterRunRACallbacks') logger.log('Initialized callbacks called') }, 'runInitializeCallbacks', @@ -55,12 +50,8 @@ const unpatchCreateElement = patcher.after( () => { unpatchCreateElement() - recordTimestamp('App_CreateElementCalled') logger.log('React.createElement called') - for (const callback of renderCallbacks) callback() - - recordTimestamp('App_AfterRunCECallbacks') logger.log('Rendered callbacks called') }, 'runRenderCallbacks', diff --git a/libraries/debug/package.json b/libraries/debug/package.json deleted file mode 100644 index dc0208c..0000000 --- a/libraries/debug/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@revenge-mod/debug", - "type": "module", - "main": "./src/index.ts", - "exports": { - ".": "./src/index.ts" - } -} diff --git a/libraries/debug/src/index.ts b/libraries/debug/src/index.ts deleted file mode 100644 index 057163b..0000000 --- a/libraries/debug/src/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -export const PerformanceTimes = { - Native_RequiredIndex: -1, - Init_Initialize: -1, - Modules_TriedRestoreCache: -1, - Modules_HookedFactories: -1, - Modules_IndexRequired: -1, - Init_PromiseResolved: -1, - Modules_RequiredAssets: -1, - App_RunApplicationCalled: -1, - App_AfterRunRACallbacks: -1, - Plugins_Registered: -1, - Storage_Initialized: -1, - Plugins_Started: -1, - App_CreateElementCalled: -1, - App_AfterRunCECallbacks: -1, -} - -export function timeOf(time: keyof typeof PerformanceTimes) { - return timestampOf(time) - PerformanceTimes.Native_RequiredIndex -} - -export function timestampOf(time: keyof typeof PerformanceTimes) { - const timestamp = PerformanceTimes[time] - if (timestamp === -1) return Number.NaN - return timestamp -} - -export function recordTimestamp(time: keyof typeof PerformanceTimes) { - return (PerformanceTimes[time] = nativePerformanceNow()) -} diff --git a/libraries/modules/package.json b/libraries/modules/package.json index b67547f..91e70eb 100644 --- a/libraries/modules/package.json +++ b/libraries/modules/package.json @@ -15,7 +15,6 @@ "./native": "./src/native/index.ts" }, "dependencies": { - "@revenge-mod/debug": "workspace:*", "@revenge-mod/utils": "workspace:*" }, "devDependencies": { diff --git a/libraries/modules/src/metro/index.ts b/libraries/modules/src/metro/index.ts index 3791964..54d08d5 100644 --- a/libraries/modules/src/metro/index.ts +++ b/libraries/modules/src/metro/index.ts @@ -1,5 +1,3 @@ -import { recordTimestamp } from '@revenge-mod/debug' - import { IndexMetroModuleId, MetroModuleFlags, @@ -121,7 +119,6 @@ function hookModule(id: Metro.ModuleID, metroModule: Metro.ModuleDefinition) { */ export async function initializeModules() { const cacheRestored = await restoreCache() - recordTimestamp('Modules_TriedRestoreCache') // Patches modules on load initializeModulePatches(patcher, logger) @@ -141,20 +138,14 @@ export async function initializeModules() { logger.log('Importing index module...') // ! Do NOT use requireModule for this __r(IndexMetroModuleId) - recordTimestamp('Modules_IndexRequired') for (let next = moduleIds.next(); !next.done; next = moduleIds.next()) { const id = next.value if (!moduleShouldNotBeHooked(id)) hookModule(id, modules.get(id)!) } - recordTimestamp('Modules_HookedFactories') - // Since cold starts are obsolete, we need to manually import all assets to cache their module IDs as they are imported lazily - if (!cacheRestored) { - requireAssetModules() - recordTimestamp('Modules_RequiredAssets') - } + if (!cacheRestored) requireAssetModules() cache.totalModules = metroDependencies.size saveCache() diff --git a/package.json b/package.json index 04646ba..d190717 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "dependencies": { "@revenge-mod/app": "workspace:*", "@revenge-mod/assets": "workspace:*", - "@revenge-mod/debug": "workspace:*", "@revenge-mod/keyutil": "https://github.com/revenge-mod/revenge-keyutil#2f5db07", "@revenge-mod/modules": "workspace:*", "@revenge-mod/plugins": "workspace:*", diff --git a/src/index.ts b/src/index.ts index c55fc74..8b0af49 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,6 @@ import '@revenge-mod/utils/functions' import { createLogger } from '@revenge-mod/utils/library' -import { recordTimestamp } from '@revenge-mod/debug' import { IndexMetroModuleId } from '@revenge-mod/modules/constants' import { ClientInfoModule } from '@revenge-mod/modules/native' import { createPatcherInstance } from '@revenge-mod/patcher' @@ -15,8 +14,6 @@ Object.freeze = Object.seal = o => o // ! This function is BLOCKING, so we need to make sure it's as fast as possible async function initialize() { - recordTimestamp('Init_Initialize') - try { const { createModulesLibrary } = await import('@revenge-mod/modules') const ModulesLibraryPromise = createModulesLibrary() @@ -56,15 +53,12 @@ async function initialize() { await import('./plugins') await registerExternalPlugins() - recordTimestamp('Plugins_Registered') await awaitStorage(settings, pluginsStates) - recordTimestamp('Storage_Initialized') // TODO: Safe mode when plugins fail to load // Maybe put logic in ErrorBoundary await startPlugins() - recordTimestamp('Plugins_Started') } catch (e) { onError(e) } @@ -100,8 +94,6 @@ if (typeof __r !== 'undefined') initialize() // We hold calls from the native side function onceIndexRequired() { - recordTimestamp('Native_RequiredIndex') - const batchedBridge = __fbBatchedBridge const callQueue: any[] = [] @@ -121,7 +113,6 @@ function onceIndexRequired() { initialize() .then(() => { - recordTimestamp('Init_PromiseResolved') unpatch() for (const queue of callQueue) batchedBridge.getCallableModule(queue[0]) && batchedBridge.__callFunction(...queue) diff --git a/src/plugins/developer-settings/index.tsx b/src/plugins/developer-settings/index.tsx index 6855468..1fac183 100644 --- a/src/plugins/developer-settings/index.tsx +++ b/src/plugins/developer-settings/index.tsx @@ -5,7 +5,6 @@ import { registerPlugin } from '@revenge-mod/plugins/internals' import { sleep } from '@revenge-mod/utils/functions' import AssetBrowserSettingsPage from './pages/AssetBrowser' -import DebugPerformanceTimesSettingsPage from './pages/DebugPerformanceTimes' import DeveloperSettingsPage from './pages/Developer' import { DebuggerContext, connectToDebugger, disconnectFromDebugger } from './debugger' @@ -85,19 +84,13 @@ const plugin = registerPlugin<{ }, }), - sui.createRoute('RevengeDebugPerformanceTimes', { - type: 'route', - label: 'Debug Performance Times', - component: DebugPerformanceTimesSettingsPage, - icon: assets.getIndexByName('TimerIcon'), - }), - sui.createRoute('RevengeAssetBrowser', { type: 'route', label: 'Asset Browser', component: AssetBrowserSettingsPage, icon: assets.getIndexByName('ImageIcon'), }), + disconnectFromDebugger, disconnectFromDevTools, ) diff --git a/src/plugins/developer-settings/pages/DebugPerformanceTimes.tsx b/src/plugins/developer-settings/pages/DebugPerformanceTimes.tsx deleted file mode 100644 index cc7ac5f..0000000 --- a/src/plugins/developer-settings/pages/DebugPerformanceTimes.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { PerformanceTimes, timeOf, timestampOf } from '@revenge-mod/debug' -import { TableRow, TableRowGroup, Text } from '@revenge-mod/modules/common/components' - -import { ScrollView } from 'react-native' -import PageWrapper from '../../../plugins/settings/pages/(Wrapper)' - -const PerformanceTimesKeys = (Object.keys(PerformanceTimes) as (keyof typeof PerformanceTimes)[]).sort( - (a, b) => timeOf(a) - timeOf(b), -) - -export default function DebugPerformanceTimesSettingsPage() { - let previousTimestamp: number - - return ( - - - - Some delta times may be inaccurate as some steps run concurrently to each other. Only look at delta - times when necessary. Steps that are marked in red were skipped/not recorded. - - - - {PerformanceTimesKeys.map(key => { - const timeNumber = timeOf(key) - previousTimestamp ??= timestampOf(key) - - const time = timeNumber.toFixed(4) - const delta = (timestampOf(key) - previousTimestamp).toFixed(4) - - if (!Number.isNaN(timeNumber)) previousTimestamp = timestampOf(key) - - return ( - // biome-ignore lint/correctness/useJsxKeyInIterable: This never gets rerendered - - ) - })} - - - - ) -} diff --git a/types.d.ts b/types.d.ts index d3b6d1f..49ee1f8 100644 --- a/types.d.ts +++ b/types.d.ts @@ -140,12 +140,6 @@ declare module '@revenge-mod/assets' { export default assets } -declare module '@revenge-mod/debug' { - const debug: typeof import('./libraries/debug') - export * from './libraries/debug' - export default debug -} - declare module '@revenge-mod/modules' { const modules: typeof import('./libraries/modules') export * from './libraries/modules'