Skip to content

Commit

Permalink
Use the RemoteControl Hook Method and Fix some random stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
marcussacana committed May 22, 2019
1 parent 9eeef4d commit 906eaaf
Show file tree
Hide file tree
Showing 15 changed files with 1,183 additions and 240 deletions.
Binary file modified Help/How To.txt
Binary file not shown.
100 changes: 97 additions & 3 deletions Help/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,112 @@ R: SRLx32.dll is corrupted, maybe...

-I Have Injected the SRLx32.dll in my game, but the Char reloads shows wrong char...
R: Maybe you need modify the CreateFont function, break the CreateFont Calls and see the right place to change the font encoding
N: puting a "mov byte ptr [eax+0x17], 0x00" before the CreateFontCall where EAX = the push pointer to the CreateFontIndirect,
N: and 0x00 the Charset, read more here: https://msdn.microsoft.com/en-us/library/cc194829.aspx
N: Try enalbed the CreateFont Hook and set the Charset to 0x00 in the SRL.ini

-About the SRL.ini
I will explain only what looks needed, run the game with "-help" to se the others value...
At StringsReloader
-"InEncoding" The Input Encoding; you can use 932/Unicode/utf8/ISO-8859-1 or any shit, google your encoding name...
-"OutEncoding" The same; but used to return a matched string...
-"Encoding" Set the InEncoding and OutEncoding the same encoding.
-"Wide" True or False; Is the setting to modify the read/write method to Encoding with 16-bits
-"AntiCrash" True or False; Is the setting to games who crash on close, this can fix some cases terminating the process on you request to close it.
-"FreeOnExit" A alternative to the AntiCrash
-"MatchIgnore" Txt1,Txt2,Txt3; Is a setting to append at the default Match ignore list, every string in the list is ignored by the string match.
-"TrimChars" (,),*; Is a setting to append strings to trim from end and begin of every line, this don't affect the return string.
-"Delay" Log the Delay to reload very string
-"Dump" Dump the Strings.srl including the translation
-"DumpRetail" Dump the Strings.srl but don't export the translation
-"Debug" Enable the Debug Output Window
-"LogAll" Verbose mode, log all string reloads
-"LogInput" Log all strings that the game requested the SRL translation
-"LogOutput" Log all strings that the SRL return to the game
-"LogFile" Save the Log window output to the a file (SRL.log)
-"Unsafe" When false the SRL don't initialize while the game don't try load a string that is recognized game as dialogue.
-"Rebuild" Rebuild the Strings.srl every time that the game starts
-"TrimRangeMismatch" Trim from the begin and end all chars from input strings that isn't in the "AcceptableRange" list
-"AcceptableRanges" Acceptable range of chars, use the char: - to specify a range, like 0-9, A-z, you can put a single char too, just don't put the -
-"NoTrim" Disable all trim algorithms of the SRL
-"BreakLine" Set if the game have their own breakline flag, (the default is the 0x0A byte)
-"ReloadedPrefix" Put a prefix in all reloaded lines
-"ReloadedSufix" Put a sufix in all realoaded lines
-"Multithread" Make the SRL optimized for Multithreaded games, when false the SRL create a new process to store their database, keep true
-"WindowHook" Try hook all windows user interface strings and allow translate it
-"Invalidate" If the WindowHook only translate when you put the cursor over the text, enable this
-"CachePointer" Cache the reload and speed up if the game request it again
-"NoDiagCheck" Allways think in a string as a Dialogue, Don't enable with Unsafe=false
-"LiteralMask" Reload strings Mask literally
-"LiveSettings" Reload the SRL.ini without restart the game (Some features require restart)
-"DecodeInputRemap" Restore any char reload in the input string before process
-"MultiDatabase" Create multiple databases to every .lst file, Increase memory usage but speed up the SRL
-"NoReload" Disable the SRL
-"WorkingDir" Set a custom directory as workspace of the SRL, keep empty to use the SRL dll directory
-"ReloadMaskArgs" If a mask contains a string that needs be translated, keep true
-"CustomCredits" Set a custom message during the SRL loading screen
-"LiteMode" Disable many features of the SRL to speed up
-"RemoveViolations" If you put a char in the .lst that is being used by the Char Reloader feature, when true, the SRL will cutoff all 'ilegal' chars
-"AsianInput" Hint the Dialogue Detection algorithm saying if the game is a japanese game or not.
-"CaseSensitive" The SRL database match can match with case senstive or not, just change this
-"NotCachedOnly" Use the pointer cache to don't allow the SRL process again the same string
-"SetOutEncoding" If the Debug Low Window (aka console) display invalid chars, set true
-"AllowEmptyReloads" Keep in the database Reloads that don't change nothing

At WordWrap
-"Enable" Disable or Enable the SRL Auto Wordwrap engine
-"Monospaced" When false the FontName, FontSize, Bold are required
-"FakeBreakLine" If the engine don't have any breakline char, the fakebreakline full the line with space to automatically break the line where needed
-"FontName" The font face name to be used in the string measure
-"FontSize" The font size to be used in hte string measure (decimal)
-"Bold" If true, the string will measure using bold font
-"MaxWidth" When Monospaced is true, put the max count of characters per line, when false, the max line width in pixels

At MTL
-Self-Explanatory entries... But to enable the TLib.dll is required in the game directory, you can get it at my github.
-Self-Explanatory entries... But to enable the TLib.dll is required in the game directory, contact-me

At Overlay (Required the Overlay.dll in the directory)
-"Enabled" Enable or Disable the Overlay
-"Padding" Set a default overlay padding

At Filter (Dialogue Detection algorithm)
-"DenyList" List of all characters that never will appear in a dialogue (split with ,)
-"QuoteList" List of all quotes that appears in the game (split with ,)
-"IgnoreList" List of things to ignore when try detect if is a dialogue
-"TrimList" List of characters that can appears in the begin or end of a string that needs be removed before process the dialogue
-"Sensitivity" The dialogue sensitivity level, (can use negative values), bigger values are more 'permessive' than smaller values (5 is recommended)
-"UseDB" If the string is present in the database is automatically accepted as dialogue
-"ForceTrim" If you enable the "NoTrim" feature, can enable this to reenable the trim only to verify if is a dialogue

At Intro
-"MinSize" Minimal Window Width and Height to show the introduction
-"Seconds" The seconds to show the introduction screen
-"CheckProportion" A alternative to the MinSize, Only show the introduction when the Width is bigger than the Height
-"CreateWindowEx" Hook the CreateWindowEx to show the Intro
-"ShowWindow" Hook the ShowWindow to show the intro (Recommended)
-"SetWindowPos" Hook the SetWindowPost to show the Intro
-"MoveWindow" Hook the MoveWindow to show the Intro

At Hook
-"CreateFile" Hook the game file reading and allow he read files from the SRL worspace or a directory called "Patch"
-"UndoChars" Undo the char reload in the MultiByteToWideChar, TextOut and ExtTextOut hooks
-"MultibyteToWideChar" Hook the MultibyteToWideChar and reload the string
-"SetWindowText" Hook the SetWindowText and reload the string
-"GetGlyphOutline" Hook the "GetGlyphOutline" and reload the character
-"TextOut" Hook the TextOut and reload the string
-"ExtTextOut" Hook the ExtTextOut and reload the string
-"CreateFont" Hook the CreateFontA and CreateFontW and allow modify the game font
-"CreateFontIndirect" Hook the CreateFontIndirectA and the CreateFontIndirectW and allow modify the game font
-"FontCharset" Modify the Font Charset
-"FaceName" Modify all fonts facename

At [Hook.Font.?] (You can create any amount of font remap, just put Hook.Font.0, Hook.Font.1, Hook.Font.2, Hook.Font.3... and etc)
-"FromFont" The original font facename to replace (keep * to all fonts)
-"ToFont" The modified font facename to force the game load
-"Size" Try modify the font size (accept relative values, +10, -10... and absolute values 32, 20, 24)

-How to use the Intro
R: To the intro hook catch the game initilization it's obvious, the SRL needs initialize before the game,
N: If the SRL have a delayed initialization try rename the SRLx32.dll to d3d9.dll, and modify the game exe to load the d3d9.dll and not the old SRLx32.dll

-I have 2 identic lines that but I don't want the same translation to both
R: Split the .LST in 2 files, the .lst format don't support duplicated lines, then put one of those lines in a new .lst file
N: If you put ::SETDB-Sample:: in the first of the line translation, the SRL will change to the "Strings-Sample.lst" after match the current string, with this you can translate a duplicate that appears one after other
7 changes: 7 additions & 0 deletions SRL/FileWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private static void LoadConfig() {
ForceTrim = false;
NotCachedOnly = false;
AllowEmpty = false;
ImportHook = false;
HookCreateWindowEx = false;
HookShowWindow = false;
HookSetWindowPos = false;
Expand Down Expand Up @@ -628,6 +629,12 @@ private static void LoadConfig() {
Log("Intro Injector Proportion Validator Enabled", true);
}

if (HookSettings.ImportHook)
{
ImportHook = true;
Log("Import Table Hook Method Enabled", true);
}

if (IntroSettings.Seconds > 0)
Seconds = IntroSettings.Seconds;

Expand Down
26 changes: 13 additions & 13 deletions SRL/Hook/FileHook.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Runtime.InteropServices;

namespace SRL
Expand All @@ -15,12 +14,13 @@ static void InstallCreateFileHooks()
dCreateFileA = new CreateFileADelegate(CreateFile);
dCreateFileW = new CreateFileWDelegate(CreateFile);

hCreateFileA = new FxHook("kernel32.dll", "CreateFileA", dCreateFileA);
hCreateFileW = new FxHook("kernel32.dll", "CreateFileW", dCreateFileW);
hGetFileAttrA = new FxHook("kernel32.dll", "GetFileAttributesA", dGetFileAttrA);
hGetFileAttrW = new FxHook("kernel32.dll", "GetFileAttributesW", dGetFileAttrW);
hGetFileAttrExA = new FxHook("kernel32.dll", "GetFileAttributesExA", dGetFileAttrExA);
hGetFileAttrExW = new FxHook("kernel32.dll", "GetFileAttributesExW", dGetFileAttrExW);
hCreateFileA = AutoHookCreator("kernel32.dll", "CreateFileA", dCreateFileA);
hCreateFileW = AutoHookCreator("kernel32.dll", "CreateFileW", dCreateFileW);
hGetFileAttrA = AutoHookCreator("kernel32.dll", "GetFileAttributesA", dGetFileAttrA);
hGetFileAttrW = AutoHookCreator("kernel32.dll", "GetFileAttributesW", dGetFileAttrW);
hGetFileAttrExA = AutoHookCreator("kernel32.dll", "GetFileAttributesExA", dGetFileAttrExA);
hGetFileAttrExW = AutoHookCreator("kernel32.dll", "GetFileAttributesExW", dGetFileAttrExW);


hCreateFileA.Install();
hCreateFileW.Install();
Expand Down Expand Up @@ -87,12 +87,12 @@ static string ParsePath(string Path)
static CreateFileADelegate dCreateFileA;
static CreateFileWDelegate dCreateFileW;

static FxHook hGetFileAttrA;
static FxHook hGetFileAttrW;
static FxHook hGetFileAttrExA;
static FxHook hGetFileAttrExW;
static FxHook hCreateFileA;
static FxHook hCreateFileW;
static UnmanagedHook hGetFileAttrA;
static UnmanagedHook hGetFileAttrW;
static UnmanagedHook hGetFileAttrExA;
static UnmanagedHook hGetFileAttrExW;
static UnmanagedHook hCreateFileA;
static UnmanagedHook hCreateFileW;

[UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Ansi, SetLastError = true)]
delegate uint GetFileAttributesADelegate([MarshalAs(UnmanagedType.LPStr)] string Filepath);
Expand Down
74 changes: 0 additions & 74 deletions SRL/Hook/HookFX.cs

This file was deleted.

Loading

0 comments on commit 906eaaf

Please sign in to comment.