Example #1
0
        public P4GPCModLoader(ILogger logger, Config configuration, Reloaded.Hooks.ReloadedII.Interfaces.IReloadedHooks hooks)
        {
            mLogger        = logger;
            mConfiguration = configuration;
            mHooks         = hooks;

#if DEBUG
            Debugger.Launch();
#endif

            // Init
            TrySetConsoleEncoding(EncodingCache.ShiftJIS);
            var version = typeof(P4GPCModLoader).Assembly.GetName().Version.ToString();
            version = version.Substring(0, version.LastIndexOf('.'));
            mLogger.WriteLine($"[modloader] Persona 4 Golden (Steam) Mod loader by TGE (2020) v{version}");
            mNativeFunctions  = NativeFunctions.GetInstance(hooks);
            mFileAccessServer = new FileAccessServer(hooks, mNativeFunctions);

            // Load mods
            var modDb = new ModDb(mConfiguration.ModsDirectory, mConfiguration.EnabledMods);

            // CPK redirector
            mCpkRedirector = new CpkRedirector(mLogger, modDb, configuration);
            mFileAccessServer.AddClient(mCpkRedirector);

            // DW_PACK (PAC) redirector
            mDwPackRedirector = new DwPackRedirector(mLogger, modDb, configuration, mCpkRedirector);
            mFileAccessServer.AddClient(mDwPackRedirector);

            // XACT (XWB, XSB) redirector
            mXactRedirector = new XactRedirector(mLogger, modDb, configuration);
            mFileAccessServer.AddClient(mXactRedirector);
        }
Example #2
0
        public P4GPCModLoader(ILogger logger, Config configuration, Reloaded.Hooks.ReloadedII.Interfaces.IReloadedHooks hooks)
        {
            // Enable file logging only if console is enabled
            // performance impact would be too great otherwise
            if (Native.GetConsoleWindow() != IntPtr.Zero)
            {
                mLogger = new FileLoggingLogger(logger, "p4gpc.modloader.log.txt");
            }
            else
            {
                mLogger = logger;
            }

            mConfiguration = configuration;
            mHooks         = hooks;

#if DEBUG
            Debugger.Launch();
#endif

            // Init
            TrySetConsoleEncoding(EncodingCache.ShiftJIS);
            mLogger.WriteLine("[modloader] Persona 4 Golden (Steam) Mod loader by TGE (2020) v1.1.2");
            mNativeFunctions  = NativeFunctions.GetInstance(hooks);
            mFileAccessServer = new FileAccessServer(hooks, mNativeFunctions);

            // Load mods
            var modDb = new ModDb(mConfiguration.ModsDirectory, mConfiguration.EnabledMods);

            // DW_PACK (PAC) redirector
            mDwPackRedirector = new DwPackRedirector(mLogger, modDb);
            mFileAccessServer.AddClient(mDwPackRedirector);

            // XACT (XWB, XSB) redirector
            mXactRedirector = new XactRedirector(mLogger, modDb);
            mFileAccessServer.AddClient(mXactRedirector);
        }