Coder Social home page Coder Social logo

reloaded-project / reloaded-ii Goto Github PK

View Code? Open in Web Editor NEW
519.0 17.0 73.0 80.06 MB

Universal .NET Core Powered Modding Framework for any Native Game X86, X64.

License: GNU General Public License v3.0

C# 61.87% C++ 34.51% C 0.76% PowerShell 2.30% Handlebars 0.57%
csharp x64 x86-64 mod-loader mod-manager universal reverse-engineering windows

reloaded-ii's Introduction

Reloaded II



Nothing else matters.
Universal, C# based mod loader.
Works with anything X86, X64.

Introduction

[Reloaded II] is a universal DLL injection based Mod Loader and Mod Management Framework.



It's a fully free and open source swiss army knife for modding native games.
Made from the ground up proudly using the C# programming language.

For more information, please visit the Reloaded-II website.

Contributions

Contributions to this project are highly encouraged.

Feel free to implement new features, make bug fixes or suggestions so long as they are accompanied by an issue with a clear description of the pull request.

Documentation is just as welcome as code changes!

reloaded-ii's People

Contributors

akirajkr avatar almightylks avatar animatedswine37 avatar antjun avatar dependabot[bot] avatar dreamsyntax avatar editorkos avatar gurrenm3 avatar ilducci avatar itskaa avatar jpiolho avatar jroweboy avatar mark-shun avatar monkeyman192 avatar roker2 avatar romsstar avatar sencaid avatar sewer56 avatar wistfulhopes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reloaded-ii's Issues

Won't Run/Open at all after installing dependencies

I've installed, Uninstalled, and Reinstalled all dependencies multiple times, restarting my computer each time and trying running both with and without admin privileges and it just doesn't open at all. As far as I can see when looking at task manager the program isn't even crashing cause it isn't opening in the first place. I'm desperate for advice. I've seen others online post this issue elsewhere and no responses besides "make sure you've installed all the dependencies" has been given, which as I've made clear I have certainly done.

Reloaded II - Support .NET 5

A few days ago, .NET 5 was introduced, alongside upcoming features such as Java interoperability and support for static AOT compilation based on LLVM, which to me both sound like a wet dream allowing to both introduce a larger user base to Reloaded and bring forth considerable startup performance improvements.

Nonetheless, it would be nice to have Reloaded running on bleeding edge frameworks as it always been the case. Ideally I would very much like to be able to have mods running on .NET Standard DLLs, but thus far this has not been possible.

The Major Problem: DLL exports

Reloaded and Reloaded-II are based both on DLL Injection, which requires the use of DLL Exports.

3F/DllExport

Currently support for DLL Exports is provided by 3F/DllExport , which unfortunately does not support either the new Project SDK .csproj format or .NET Standard/.NET Core/CoreCLR.

The author is uncertain of when support may arrive due to a busy lifestyle. 3F/DllExport#90

An alternative path?

On the other hand, the inclusion of DLL Exports in Roslyn and the C# language has been a long requested feature: dotnet/csharplang#308 , dotnet/roslyn#1013 , dotnet/roslyn#11771 etc.

It is known that DLL Exports already is and has for a long time been supported inside both .NET Framework as well as more recently CoreRT.

In a context slightly unrelated to Reloaded. Given that in nature .NET 5 will unify the three major runtimes, I believe the DLL Export feature would be especially useful if not simply absolutely necessary when working on Linux/OSX/Unix environments where the native C & C++ languages dominate to allow the mixing of managed and unmanaged code.

Time will only tell should DLL Exports become an official language feature.

[More Info Needed] Loader Config Corruption

Every time I open up Reloaded, this weird error keeps opening up. I don't know exactly why this keeps on happening. I've downloaded all the prerequisites and ran it as an admin. Here's a screenshot of the error below:

image

Bug: Config files in subfolders should probably be ignored.

Describe the Bug
Currently config files in mod subfolders are not being ignored by the launcher

To Reproduce
A new user's workflow may look like the following:

  1. Go to Mod Readme
  2. Go to Dependency Download Page
  3. Download the source code instead of the mod.
  4. Extract the source code.

Expected Behaviour
The launcher should ignore the mod configuration present in the source code if it's not in the root folder to prevent users from making this mistake.

Screenshots
explorer_DbkBq8jF7E

image

Error when launching p4g

After multiple retries, and meeting all requirements, the game won't load. It'll just stay on a black screen (that turns gray) with "Not Responding".

[Windows Bug: Windows Replaced Reloaded icon in Taskbar with one of the Games, Clean Your Cache]

I ran Sonic mega Collection Plus through reloaded and after a certain number of times doing that with no issue the icon shown on the windows toolbar suddenly became the Sonic Riders Icon, I try removing the application from Reloaded II but the Icon changed to the Sonic Riders one instead.

To Reproduce
I do not know how to reproduce this as I do not know how to change it back to test what I did to cause it in the first place. though the issue may have start after I tried inputting command line arguments for sonic mega collection plus through reloaded ii (the issue happened a while ago and I felt no need to mention it since it wasn't causing me any issues)

Expected Behaviour
I expected the Icon to be the Regular R-II that can be seen as the icon for the exe

Screenshots
image

[.NET Core] When using `dotnet build` Reloaded.Mod.Launcher cannot be used by consumers due defined PropertyChanged dependency.

See: Fody/Costura#358

Prologue

.NET Core, including .NET Core 3 use a JSON text file that explains file dependencies. This file is checked by the .NET Runtime and if a dependency is missing, the runtime refuses to load the application.

Problem

PropertyChanged is not actually needed by the assembly and thus not copied to the output folder during dotnet build. However the dependency is still present in the .deps.json file, and thus the launcher would refuse to boot.

Note: For developers, the library will still be found due to the runtimeconfig-dev.json configuration, pointing to NuGet cache folders, but end users wouldn't have said folders.

Temporary Workaround

Include dummy PropertyChanged.dll in project to be copied to output.

Feature: Standalone NuGet Build Tool

Is your feature request related to a problem? Please describe.
Currently the build script Publish.ps1 available within the mod template outputs .zip files ready for uploading onto the internet. However, there is no output available that would be ready for uploading straight onto the Reloaded Community Mod Repository.

The launcher does currently provide this functionality as seen here:
image

However, that unfortunately comes with a few limitations and caveats.

  • Cannot be integrated into a CI/CD setup.
  • Requires the user to mix with existing mod files. This can cause user configs to be mixed in if the user is not careful!

Describe the solution you'd like
A standalone tool (as opposed to the launcher option), that converts a mod zip output by the current build scripts into a NuGet package.

Preferably, remove the current functionality from the launcher and remove the dropdown.

Bug: System.InvalidOperationException when rapidly clicking a registered application

By rapidly clicking on any of the registered applications in the main Reloaded II interface, it will simply close, skipping the exception handler.

Steps to reproduce the behaviour:

  1. Launch Reloaded II.
  2. Click on any registered application with rapid succession.
  3. Crash.

Expected Behaviour
The interface for the application should display without fault.

Screenshots
81odNiSr4K

Exception Information

Application: Reloaded-II.exe
CoreCLR Version: 4.700.20.36602
.NET Core Version: 3.1.7
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
   at Reloaded.WPF.Controls.PageHost.get_CurrentPage()
   at Reloaded.Mod.Launcher.Pages.BaseSubpages.ApplicationPage.Dispose()
   at Reloaded.Mod.Launcher.Pages.BaseSubpages.ApplicationPage.Finalize()

Reloaded II - Injection Mechanisms

Below is a list of planned injection mechanisms for the final 1.0 version of Reloaded II.

  • Manual Launch
  • Manual Attach
  • Auto Attach
  • DLL Loader

Descriptions

Manual Launch

Default mode of Reloaded I.

Reloaded II launches the process in a suspended state, then injects the mod loader.
The mod loader initializes and loads the mod and the process is resumed.

Manual Attach

Semi-hidden (documented) mode of Reloaded I.

Reloaded II loads inside a currently running program, optionally suspending it before load for the load duration and initializes all mods.

Auto Attach

New in Reloaded II.

Reloaded II automatically detects launched programs by the user. If said program is registered in Reloaded and has at least 1 mod enabled, Reloaded is injected with mods.

Optional: Suspend and Resume Process

Technique described in Sewer56/Reloaded-Mod-Loader#15

DLL Loader

An optional extra for those who desire it.

A Reloaded Mod Loader II Loader in DLL form which finds the newest installed version of Reloaded on the machine and loads it into the target process.

This way you can integrate Reloaded as a mod for other mod loaders.
This solution will be tested against Ultimate ASI Loader.

Reloaded-II will provide no DLL Hijacking solution of its own.

Documentation: Better Readable Documentation via MkDocs

Is your request related to a feature? Please describe.
Produce a dedicated website with MkDocs for hosting documentation such that it is easier to read and consume by the end users.

Transfer existing documentation to said website and automatically deploy using Github pages.
Will probably want to use Github Actions (e.g. deploy-mkdocs) or AppVeyor to automatically push docs when applicable on new commits.

Example MkDocs site: https://loic-sharma.github.io/BaGet/

image

Reloaded II - Implement Basic Plugin System

Implement super basic plugin system (similar to Reloaded I) to allow for extra injected code to be ran on certain events within the application.

List of Plugins for Release:

  • Reloaded I Updater: Auto updates Reloaded I mods with no code (config only) to Reloaded II.

Feature: Stub EXE For Dependency Checking

The Problem
I'm continuously frustrated with users every other day asking for help because they did not install the dependencies required.

This generally amounts to what feels like 75-80% of all questions asked at least on the Heroes Hacking Central where I run my operations for a certain 16 year old game.

The Current Solution
In the past, the required dependencies were at the top of readme. This did not work very well on Github, as the user required to scroll the page to see the dependencies; so it was changed in favour of a more optimised system. However, surprisingly, a lot of GameBanana users had a tendency of missing the prerequisites too, which was an annoyance.

I then figured that placing the dependencies beside the download buttons so that the users literally can't miss them would be better. This worked out pretty well at the time, however as more and more users started to use Reloaded, the issue would once again become an annoyance.

As seen on Github:
image

As seen on GameBanana:
image

Describe the solution you'd like
We should have a proxy EXE that runs on .NET Framework which performs a dependency check for Core and informs the user if the dependencies are missing. We may download Core ourselves using the dotnet-install script after informing and receiving consent from the end user.

Additional context
There is no official library or recommended means of checking what versions of Core are installed on the machine.
The easiest way to check however would be by inspecting the Program Files\dotnet\shared\ and Program Files (x86)\dotnet\shared\ folders.

These folders contain a folder for each of the installed runtimes ASP, Desktop, App and inside those, folders for each version, including previews.

Ideally we wouldn't want to have to manually specify the required version, so we would want to parse runtimeconfig.json and then extract the required framework from the given configuration file. It is important however that we parse any custom rollforward option as specified per https://github.com/dotnet/designs/blob/master/accepted/2019/runtime-binding.md#rollforward and appropriately resolve if the user has compatible Core versions installed.

Request: UI Improvements and Changes

UI Improvements and Changes

This is a random collection of feedback from various users, from waifu to long time community contributors.
This list is being updated as time progresses.

Shell Sidebar

image

Sorting

  • Complete

There is currently no order to how the individual games are displayed, as it is only expected to have users add 3-4 applications at most. However, Reloaded has been getting traction and for the real power users out there, sooner or later this number may expand.

The current display order is alphabetically by AppId (normally EXE name), because that is how the list of configs is returned from filesystem, however it may be a good idea to sort items by most commonly used at the top.

To do this, we'll need to add an open tracker into each AppConfig for the number of times the application has been launched.
Don't know if we should track application launches (have loader increment the counter) or the amount of times the icon has been clicked in the launcher.

Recents

  • Complete

The most recently selected items might be displayed either in the default screen of the application or in the default/settings/info menu.

More Useful Links

  • Reloaded Discord (currently in the works)
  • Author's Social Media
  • Github
  • Donation Page? (I've accepted $0 + a copy of Nekopara in my life as of time of writing)

Add Application

Reloaded-II_ZrtbmLTdpQ

UX: Change Icon

  • Complete

You can currently change the game logo by clicking the one extracted from the EXE, however not all users seem to know this.
It might be a good idea to add an explicit button for this or reduce the tooltip delay.

Rename Menu

  • Complete

As suggested by @Shadowth117 , the Add Application menu is by nature misleading, since it can also edit applications.
It should ideally be called Add/Edit Application.

Move Advanced Options

  • Complete

For convenience the advanced options such as the Auto-Inject toggle should preferably be moved into the application sidebar instead of being in the Add/Edit Application menu to enhance discoverability.

As end users do not read tooltips, toggling Auto Inject option should probably produce a warning dialog telling the user the information currently present in the tooltip.

Might be good to have a way to at least remove the bootstrapper ASI file as a way to "undo" the ASI Loader deployment.

Application Menu

image

Categorise Items

  • Complete

Example:
image

Create Mod

  • Complete

image

The list of dependencies should preferably have fixed height (like mod list) and
be searchable, much like the Manage Dependencies menu.

image

Contribute

If you have your own UI ideas, fire them away here.
Here's a list of what would be considered Essential Items, anything else is up to your interpretation.

Error when launching

When I launch Persona 4 Golden, I get the message "The type initializer for 'Reloaded.Mod.Launcher.Utility.BasicDllInjector' threw an exception."

Image with log:
Screenshot_8

I've installed all prerequisites and restarted my computer several times.

[Help Wanted!!] Backup NuGet Mirror and/or New Site

Background
Currently Reloaded II stores common code mod dependencies (shared libraries etc.) on a BaGet server located at http://packages.sewer56.moe:5000/upload , to which any user can upload to.

This is problematic as this is a singular/only source for a lot of my own mods (latest versions) and packages used as dependencies by other 3rd party mods. If the server goes down, we're gonna have a bad time.

screencapture-167-71-128-50-5000-home-2020-08-19-22_32_04

Security Concerns
While weekly backups of the server content are taken, there are no moderation tools available on this NuGet mirror; not even I can delete stuff without manually editing the on server files and database. There is unfortunately nothing stopping anyone from just flooding the server with dummy packages at the current moment in time and filling up all of the server's storage to effectively take it down.

Describe the Solution
This really requires a two step solution:

The first is to make improvements to the BaGet Server:

  1. Implement moderation tools into the BaGet server, to allow packages to be removed by superusers.
  2. Allow superusers to restrict downloads.
  3. Add rate limits to prevent spamming of packages onto the server.

The second is to make a mirror for the server and have Reloaded pull from there when the primary server is down:

The Reloaded NuGet server should use a backup server for dependency fetching such as nuget.org, when the default server is not available. This server should however NOT be used in the Download Mods menu.

Reloaded II - Write Mod Porting Guide

Write a guide for porting code mods from Reloaded I to Reloaded II.

This should be done only once an initial implementation of Reloaded II is functional including other key features such as self updating.

Given that current implementation of the Reloaded libraries, e.g. Reloaded.Memory are similar to their original libReloaded counterparts, the actual mod porting process should be rather simple down the line.

i.e. This is one of the things to do last before the first release.

Improving Reloaded's Reputation through Improving User Experience

Background

I have always felt as if Reloaded has always had a bad reputation among mod loaders due to users' inability to set it up properly (even though it is not difficult!). I often witness various threads for mods and guides showered with identical copycat questions as opposed to positive comments, which in my opinion is a great deterrent from the eyes of a potential new user.

Normally, end users take things to work out of the box for granted; i.e.

  • Mod launcher boots on first try.
  • Magically detects the game.
  • User adds mods.
  • Presses Play and it runs.

For technical reasons, this is a bit difficult due to Reloaded's situation of being a universal loader.
You can't possibly know what the end user will use the loader with, and because it runs on .NET Core (which does not ship with Windows), users are required to download Core manually. Very often they forget to do this and later complain in places where they might sometimes not get help, which litters both guides, community servers and release pages for Reloaded.

Download/Install issues mostly stem from illiterate or impatient users not willing to read, as the requirements are very clearly outlined (sometimes in the same guides people complain in!), however you must also consider users without a good level of English literacy.

Another popular misconception among new users is believing that they only require x64 version of Core. While the Github version outlines this, this isn't as easy to outline on GameBanana (and some users just skim the text), hence there are also often duplicate complaints when Kernel32AddressDumper fails (BasicDllInjector failure).

For many users, mod discoverability is also an issue. This is unfortunately due to the fact that I have not always bothered to look at things from a PR perspective despite creating this loader (I should be setting a good example). For me, it was always about making good things, and not taking time out to market them; however, what is the point if nobody knows about the good stuff?
There are plenty of miscellaneous changes that should be made towards improving mod marketability, many which are outlined below.

Measures

โœ” Indicates Complete and Available in Current Development Version
โ“ Indicates ToDo or to be Finalized.
โŒ Indicates Not Yet Available

โœ” Automatic Mod Loader Dependency Checking

People are bad at reading.
See issue #43 for extra details.

โœ” Automatic Mod Dependency Downloads

Already implemented.

โœ” More Descriptive Error Messages

There are certain error messages which are triggered by common user errors or loader bugs which perhaps may be better represented. For example...

  • When .NET Core x86 is Missing (DLL Injector Failure):

  • When Loader Config gets Corrupted due to Unknown Cause (#34)

These exceptions should probably state the most likely user error and how to fix it.

โŒ User Focused Documentation

Try to target user facing documentation more towards end users in wording as opposed to power users.
e.g. Injection Methods should probably have a better name and use more simple wording.

It might also be useful to add information about using Reloaded with e.g. Steam into the documentation.

โ“ Better Mod Marketability

Here are some areas to work on, with regards to making mods (at least my own) more marketable.

  • Use more Epic keywords in more major mods.

    • e.g. Revamp, Remaster, Overhaul
    • Do not use technical terms e.g. Hook
  • Tweet. Social Media exists for a reason.

    • Use custom banner for each individual release (Gamebanana too).
    • YouTube video where appropriate.
  • Create custom banners for mods.

    • I was initially lazy but it helps for categorisation. Template banners are really really bad.
    • Many mod submissions need more images.
  • User targeted description/readmes.

    • Current ones are targeted for developers which are a no-no.
    • For example: Heroes Controller Hook is very barebones. It's not clear enough for users to use Post Process mod to flip triggers etc.
    • Need more screenshots?
  • There exist many important game specific and non-game specific mods.

Reloaded II - Write Documentation on Plugins and Controllers

Based on the recent update of Issue #5 , there is now sufficient information to write a document regarding Plugins and Controllers.

Given the complexity of the task of implementing it however, this should be deferred to doing so until the feature is fully implemented.

Reloaded II - Unify Project Templates

Specifically:

  • Add Powershell scripts for releasing mod. (Build and package ZIP)
  • Add Powershell scripts for building NuGet package.
  • Enable R2R Support
  • Include Commonly Used Libraries
  • Update from netstandard2.1 to netcoreapp3.0

Reloaded II - Loading Mods/Plugins.

Prologue

Originally I was planning to try figure some way to load the loader as a .NET Core (as DllExport does not support CoreCLR), with all mods subsequently written in .NET Standard.

This plan was in order to be (hopefully) able to share the JIT-ted code between mods as a means of reducing startup time, as I've been looking for a long time as to how to run side by side versions of assemblies (libraries) inside the same executable.

Well, it seems I was just asking the wrong question.
I was just asking "how to load side by side assembly" rather than than the two words: "JIT AppDomain".

Resources

Application Domains and Assemblies
https://docs.microsoft.com/en-us/dotnet/framework/app-domains/application-domains#application-domains-and-assemblies

Set Domain Optimization for default AppDomain (not tested to work at runtime).

AppDomain.CurrentDomain.SetupInformation.LoaderOptimization = LoaderOptimization.MultiDomain;

Epilogue

So with .NET Framework we stay. But in the case of the future, mods will still target .NET Standard.

Reloaded II - Mod and Mod Loader APIs

Mods in Reloaded 1

In Reloaded 1, mods were loaded by performing DLL Injection on the individual mods and calling an exposed DLLExport-ed entry point, Main.

In order to speed up mod loading, and support additional features such as real time loading, pausing, unloading and reloading of mods, this will change with Reloaded-II.

The Planned Reloaded 2 Way

Reloaded-II will instead have the Launcher inject the mod loader (originally: Reloaded-Loader) directly into the application, which would then in turn load other mods using the native .NET APIs.

To interact with the loader, the launcher will use a DLLExport'ed API, thus removing all networking code that originally existed in Reloaded 1 (mostly for debugging purposes).

This should make loading mods faster by noticeably reducing the amount of times the OS has to create new threads and trash them for every mod load (CreateRemoteThread) at the expenses of the cost of Reflection (which should still be faster) in finding the appropriate interface to load the mod from. Unfortunately however, this will not solve the main bottleneck of JIT recompilation as each mod is loaded into its own AppDomain.

Additional benefits include features such as being able to load AnyCPU assemblies directly instead of having to decide whether to load the x86 or x64 output of an AnyCPU build.

Disclaimer

I would like to make it very clear here. The mod loader is an (optional) service. There wouldn't be anything forcing you to have a dependency on the mod loader. The mod loader is a service.

There is nothing stopping you from, for example, DLL Exporting Start() and running the mod using a plain old DLL injector provided your mod does not rely on any of the mod loader services.

From experience, a majority of code mods will not rely on the services.

Proposed Mod API

This is the interface that every mod will require to implement to be loaded by Reloaded. It provides the mod entry point and serves as a way for the mod loader to interact with the mod.

public interface IMod 
{ 
    /* Events */
    Action Disposing { get; } // Called for you automatically by the mod loader. Executed before a mod is disposed.

    /* Actions */
    void Start(IModLoader loader); // Entry point of the mod.
    void Suspend();                // Pauses any active mod behaviour.  (Undoes changes, deactivates function hooks etc.)
    void Resume();                 // Resumes any active mod behaviour. (Re-applies undone changes, re-activates hooks etc.)
    
    void Unload(); // Pauses any active mod behaviour (same as suspend), and releases resources (e.g. File Handles, Native Memory)
                   // for the mod to be ejected (unloaded entirely) from the target program.
    
    /* Capability */
    bool CanUnload();  // Returns true if an Unload is supported/possible with this mod. (Manually defined by developer)
    bool CanSuspend(); // Returns true if Suspend and Resume are supported with this mod. (Manually defined by developer)

    /* 
        Suspend, Unload and Resume will require manual developer implementation. 
        In most cases, this will just resolve to deactivating function hooks and undoing any minor memory changes.
    */
}

Proposed Mod Loader API for Mods

This is the interface contained inside Reloaded which will allow for the mod to interact
with the mod loader itself.

public interface IModLoader 
{
    /* Information */
    Version GetLoaderVersion(); // Retrieves the version of the mod loader. (May be useful in the future)
    IApplicationConfig GetAppConfig();       // Returns the individual application configuration for the currently running application.
    ModGenericTuple<IModConfig>[] GetActiveMods();      // Returns a list of currently active mods.

    /* Events */
    event Action OnModLoaderInitialized;// Called when all mods have finished loading.
    event Action<IMod, IModConfig> ModUnloading;     // Called before the loader unloads a mod.
    event Action<IMod, IModConfig> ModLoading;       // Called before the loader loads a mod.
    event Action<IMod, IModConfig> ModLoaded;        // Called after the loader loads a mod.
 
    /* 
        Features below will require more ~~research~~ trial and error. 
        These features are juicy! 
        Taking maximum advantage of the nature of C# as a JIT-ed, managed language.
        
        Note: I already know how to do this. 
              Just don't know if AppDomains will cause additional complications with this yet.
    */
    
    /* Inter-Mod Communication: Plugins */
    
    /*
        Plugins will allow you to extend the functionality of other mods by implementing interfaces defined by them.
        The way this will work is your mod will implement interface defined by another mod.
        
        That other mod will use the API call below and make an instance of your class then, running your code.
        
        Q: How do I get other mods' interfaces?
        A: Mods that are extensible will publish packages containing only the interfaces. Preferably on NuGet.
    */
    
    WeakReference<T>[] MakeInterfaces<T>(); // Visits all loaded mods and instantiates all classes which 
                                               // inherit from a given interface, returning all instances.
                                               
                                               // Note 1: The mod from which the interface originates from is provided such 
                                               // that the interface can be removed when the moD is to be unloaded (see ModUnloading event). 
                                               
                                               // Note 2: This will probably be slow.
                                             

    /* Inter-Mod Communication: Controllers */
    
    /*
        Sometimes you want one mod to be able to directly interact with another mod, rather
        than just running code from it.
        
        For example: Suppose we have a lighting mod that allows you to manipulate the lights in a 3D scene.
        Now you, as a developer want to control it from another mod, you like flashing lights, you want to make 
        it rave!
        
        So how do you do it? In the real life, to control a game you up a joystick and press buttons!
        Why not do the same here?
        
        If you are the lighting mod, you give your joystick (interface) to the mod loader.
        If you are the rave mod, you ask the mod loader to give you the joystick.
        
        Simple.
    */
    
    void AddOrReplaceController<T>(IMod owner, T instance);    // Adds a controller to the mod loader's stored list of controllers.
    void RemoveController<T>(); // Removes a submitted controller (to be used when unloading a mod).
    WeakReference<T> GetController<T>();              // Gets a controller from the mod loader's stored list of controllers.

    /*
        Controllers In Depth: Why not "MakeInterfaces"?
        
        The problem is you need to interact with the loaded instance of the other mod.
        Using the MakeInterfaces function would just create another instance of 
        the class to manipulate the lighting mod and thus have no effect.
        
        The concept of the mod loader holding the interface instances is actually called Inversion of Control (IoC).
        
        A great way to learn about IoC is this Stackoverflow post: https://stackoverflow.com/questions/3058/what-is-inversion-of-control
        and the NInject (Dependency Injection Framework) wiki: https://github.com/ninject/Ninject/wiki/Dependency-Injection-By-Hand    
    */
}

Suggestions down to the methods, method names, interface names etc. are welcome.

Definitions

public class ModGenericTuple<T>
{
    public IMod Mod { get; set; }
    public T Generic { get; set; }
}

Reloaded II not booting Sonic Heroes

When trying to launch Sonic Heroes PC it just won't boot up, throwing an exception before closing itself, I ran the app as admin and checked if Sonic Heroes worked and they are no issues, here's the error that keeps popping up

image

Feature: Log to File

Is your feature request related to a problem? Please describe.
There is currently no functionality that can be used to log to file built into the loader.
While mods CAN intercept the mod loader's logger, they can't capture any text printed before the actual mod itself has been loaded.

This can be problematic if the error occurs before a logging mod is used.

i.e. Consider the following workflow:

  • User loads Reloaded-II with a mod that crashes.
  • Application crashes quickly without the ~2s timeout, there is no time to capture a screenshot.
  • Information is lost.

Describe the solution you'd like
Option to dump a log file built right into the mod loader, which can be enabled from the launcher's main screen.

Reloaded II - Port existing code mods from Reloaded I

Note: #3 Should be completed first.

This issue is simple.
Port own existing code based mods and others' mods to the new loader.
For most mods, this process will be trivially simple.

List of Mods:

by Sewer56

  • Global: Reloaded File Monitor
  • Global: Reloaded File Redirector
  • Global: Steam API Hook
  • Global: Universal Borderless Windowed [Not Porting]
  • Sonic Heroes: Heroes Graphics Essentials
  • Sonic Heroes: Heroes Controller Hook
  • Sonic Heroes: Heroes RPC (Discord Rich Presence)
  • Sonic Heroes: Heroes Freecam
  • Sonic Heroes: CRI Filetable Hook
  • Sonic Heroes: TONER (a.k.a. The One Expandonger)
  • Sonic Riders: Riders-RestrictionKill
  • Dolphin Emulator: Shadow The Hedgehog NTSC-U Discord Rich Presence

by Igorseabra4 & Sewer56

  • Sonic Heroes: Generic Stage Injection

by Shadowth117

  • Sonic Heroes: Team Dark SA2 Edition

by TGE

  • Sonic Adventure 2: Live Model Dumper (Currently Unreleased)
    ???

Please help with accumulating a complete list of code mods!

Reloaded II - Libraries and External Dependencies

New Dependencies

Library Thoughts
Reloaded.WPF The new Reloaded GUI. Enhanced recreation of the old WinForms GUI in WPF.
Onova Will be used as the new universal update library for both mods and the loader itself. Will develop extension library to support more formats beyond zip (Package Extractor) and GameBanana (Package Resolver) support. TODO: Tyrrrz/Onova#17
Reloaded.Assembler The x64 supporting replacement for FASM.NET with extra feature support and performance improvements.
Colormine (Stripped) Custom embedded version of ColorMine stripped by me to support only Lch, Lab, Xyz and RGB conversions. Super minimal.
Ookii.Dialogs.Wpf A small collection of useful dialogs normally not available in .NET. Also 600KB smaller than what I used before.

Dependencies from Reloaded I Not Returning

Library Thoughts
Squirrel.Windows Bit slow for me, separate system still required for mod updates, forced install in LocalAppData, 4.5MB of otherwise unused dependencies and now also discontinued
Reloaded-GUI Part of Reloaded 1, New GUI moving to WPF.
FASM.NET No support for x64. Abandoned. Requires C++ 2012 x86 redist. To be replaced by my own Reloaded.Assembler.
Colormine (Full) Removed unused features and made own embedded version. Saved ~100KB
Colorful.Console Reloaded II will not have a commandline application. Reloaded II's loader will be directly DLL injected into process and console will be controlled by the mods on demand.
Microsoft.WindowsAPICodePack-Shell and Microsoft.WindowsAPICodePack-Core 700KB for a non-crappy (Windows Vista onwards) folder selector. Thankfully there's a standalone package for it.
LiteNetLib-custom Reloaded II will have no networking components.
Reloaded.Networking Reloaded II will have no networking components.
Octokit (in Github Mod Updater Plugin) Github updated will be handled by Onova.
Vanara.PInvoke.Kernel32 Will use own P/Invoke signatures to save space.

Distribution Sizes

Reloaded I binaries only (no mods): 8.4MB
Reloaded II binaries: 2.0-3.5MB (Estimate)

Bug: Failed to Load Reloaded-II. Unable to find a configuration for the currently executing application.

Describe the Bug
I followed the procedure for installing Reloaded II and its required .NET and VC components in this video https://www.youtube.com/watch?v=YtVX3idPpjA, but when I launch the game, I get an error code that reads:

Failed to Load Reloaded-II. Unable to find a configuration for the currently executing application.
at Reloaded.Mod.Loader.Loader.LoadForCurrentProcess()
at Reloaded.Mod.Loader.EntryPoint.LoadMods()
at Reloaded.Mod.Loader.EntryPoint.ExecutiveTimed(String text, Action action)
at Reloaded.Mod.Loader.EntryPoint.SetupLoader()

To Reproduce
Steps to reproduce the behaviour:

  1. Go to 'p4g.exe'
  2. Make sure Persona 4 Golden PC Mod Loader and Steam Hook are active. I have also tried with the Reloaded II Shared Lib: Reloaded.Hooks active as well.
  3. Click on 'Launch Application.'
  4. Error occurs.

Expected Behaviour
Reloaded II should launch Persona 4 Golden with mods activated.

Screenshots
https://ibb.co/KhWbhW1

Additional Context
I've verified in Add/Remove Programs that my I have the correct VC C++ versions for both x86 and x64, and the .NET installer reports that it they are also both successfully installed.

Reloaded II won't open.

I've installed everything in the Prerequisites section on the main page, and I have tried opening it as an admin, but it doesn't work. It just doesn't open at all.

Reloaded II - Config File Formats / Programming Interfaces

Reloaded II - Config Files / Interfaces

Below is an early revision of the planned list of interfaces intended for dealing with config files.

This issue only concerns itself with the information stored in the individual configuration files, no backing C# code interfaces for dealing with the files themselves.

At the time of writing, most of the interfaces here should be fairly similar to Reloaded I, albeit with some simplifications and name changes.

Interface: Application/Game Configuration

public interface IApplicationConfig
{ 
    string AppName          { get; set; } // Visible name of the application. (Launcher)
    string AppLocation      { get; set; } // Location of the main executable of the application.
    string AppArguments     { get; set; } // Commandline arguments to run the application with if running from the launcher.
    string AppIcon          { get; set; } // Location of the Application Icon image relative to the config file.
    string[] EnabledMods    { get; set; } // Collection of Enabled mods for the application, by Mod Folder
}

Interface: Mod Configuration

public interface IModConfig
{
    string ModId             { get; set; } // Name uniquely identifies the mod.
                                           // Format: "game.type.name"
                                           // Example: sonicheroes.asset.seasidehillmidnight
                                       
    string ModName           { get; set; } // The visible name of the mod.
    string ModAuthor         { get; set; } // Name of the author of the mod.
    string ModVersion        { get; set; } // The version of the mod. Recommended: Semantic Versioning.
    string ModDescription    { get; set; } // Short description of the mod.
    string ModIcon           { get; set; } // Location of the Mod Icon image relative to the config file.
    string ModDll            { get; set; } // DLL file associated with the mod. (Compiled as AnyCPU for universal mods)
    string[] ModDependencies { get; set; } // List of ModId(s) of other mods that this mod requires to run.
    string[] SupportedAppId { get; set; } // List of Supported AppIDs
}

Interface: Launcher Configuration

public interface ILauncherConfig 
{
    bool FirstLaunch        { get; set; } // UX: False on first launch, then true. For displaying welcome/help messages etc.
    bool AutoAcceptUpdates  { get; set; } // UX: Updates the loader automatically without user input.
}

Reloaded II won't open

I've seen this happen two other times, but it looks like there have been different reasons as far as I can tell. Simply put, Reloader II won't open even though I've downloaded the prerequisites, and my computer doesn't seem to accept dotnet Reloaded-II.dll as a command

[Info Needed] Possible Launcher Crashes?

Launcher Crashes

I have only seen two people out there who have experienced this issue, where the launcher may crash during transition from one page to another. One of them which was a random GameBanana commenter on and another was a user on the Heroes Hacking Central (Sonic Heroes Hacking Server).

These seem to stem from possibly an internal WPF issue, however sadly, we don't know.

What Does Not Cause This

  • UXStyle/Other OS UXTheme Modifications
  • Operating System

Possibly something related to the graphics driver? Nobody has a clue, I don't know anyone who can reproduce this anymore.

The user was running Win 8.1, I tried to reproduce the setup in a VM but could not reproduce the issue.
Image

What Does Cause This

  • .NET Core?

The sample application at Reloaded.WPF worked under Framework for the one user in the Heroes server but crashed under Core.

Logs / Evidence

Problem signature:
  Problem Event Name:    CLR20r3
  Problem Signature 01:    E3PI0P3JHNUWL3KDAEQBACWL0NYQYULK
  Problem Signature 02:    1.0.0.0
  Problem Signature 03:    5d7bb03a
  Problem Signature 04:    PresentationCore
  Problem Signature 05:    4.800.19.46214
  Problem Signature 06:    5d7aa4cf
  Problem Signature 07:    2bc1
  Problem Signature 08:    13
  Problem Signature 09:    System.OutOfMemoryException
  OS Version:    6.3.9600.2.0.0.256.48
  Locale ID:    1033
  Additional Information 1:    9244
  Additional Information 2:    9244bb0f1c7dc69d958acff53aba026f
  Additional Information 3:    f3da
  Additional Information 4:    f3dabbf1ba6cd4aa30382ed8039ea5fc

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=280262

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

unknown

Transparent WPF Window in Reloaded Theme:
Transparent Window

Suggestions

  • Change launcher thread priority from Normal to some other value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.