[Mod] Better Map Screenshot

Started by kubinator4321, October 30, 2017, 04:19:14 PM

Previous topic - Next topic

kubinator4321

Hello, coming to the forums from the discord I bring you what might be the first mod for Particle Fleet. Now, I'm not sure if this is the right place for this, but I'll just stay hopeful for now.

The mod does three things:

       
  • Map screenshots (F11 by default) are now 4x the resolution
  • Map screenshots now hide all Text and ResourceBar while taking the screenshots
  • Screenshots are now in PNG format (increases both file size and quality)
Installation is simple: Unpack the zip into "Particle Fleet Emergence\ParticleFleet_Data\Managed" and run the patch.bat file.
The download is attached to the post.

Now, for a bit of technical details:
The way this mod works is that the Assembly-CSharp.BetterScreenshot.mm.dll contains a bit of C# code - it uses the PF dll as a reference, along with monomod and unity's dlls. It contains some classes extended from ones from the original game, which are patched by monomod.exe.
The way the patcher is built, the dll being patched in can contain methods that replace the ones in the game. Those methods can then simply override existing code, or call the original method with changed parameters.
This mod utilizes both "ways" of patching - one method completely replaces the code in order to scan for .png files instead of .jpg, whereas the code to change the resolution of screenshots simply changes the zoom value before calling the appropriate method.

As for the source, this is as much as I can give right now: https://pastebin.com/cTN2jYR9
I'm planning to set it up properly, but the project requires files from the game - and I obviously don't want to distribute them as is. I'm trying to figure out CIL-stripping, which would essentially remove all of the code and leave only things necessary for compiling, so if that happens, I'll be able to share a fully functional project you can compile yourself.
For now, if you want to recreate the project, you'll have to link the Assembly-CSharp.dll file, UnityEngine.dll and UnityEngine.UI.dll, as well as MonoMod.exe before compiling the code as a Class Library (assuming Visual Studio).


The source is now available on gitlab: https://gitlab.com/KubeRoot/PFBetterScreenshot

EDIT:
If you want to try it out yourself, check out the monomod project on github and discord

EDIT 2: The original .zip file was missing a library and thus failing to patch, sorry for that! I added the library, as well as a pause to the end of the patch.bat file, to help make any issues more noticable.
EDIT 3: Fixed again, keeping same filename, the patching file was using non-standard commands. Again, sorry, I forgot I even had those when checking if it's valid.