Beispiel #1
0
        uint hGetCharacterPlacement(void *hdc, byte *lpString, int nCount, int nMexExtent, GCP_RESULTSA *lpResult, uint dwFlags)
        {
            CString InStr = lpString;

            InStr.FixedLength = (uint)nCount;

            InStr = EntryPoint.Process((CString)(string)InStr);//Ensure Null-Terminated

            if (Config.Default.GetCharacterPlacementAUndoRemap)
            {
                InStr = Remaper.Default.Restore(InStr);
            }

            if (Config.Default.GetCharacterPlacementARemapAlt)
            {
                InStr = RemaperAlt.Default.Apply(InStr, null);
            }

            return(Bypass(hdc, InStr, InStr.Count(), nMexExtent, lpResult, dwFlags));
        }
        private unsafe bool hGetTextExtendPoint32(void *hdc, byte *lpString, int c, SIZE *psize)
        {
            CString InStr = lpString;

            InStr.FixedLength = (uint)c;

            InStr = EntryPoint.Process((CString)(string)InStr);//Ensure Null-Terminated

            if (Config.Default.GetTextExtentPoint32AUndoRemap)
            {
                InStr = Remaper.Default.Restore(InStr);
            }

            if (Config.Default.GetTextExtentPoint32ARemapAlt)
            {
                InStr = RemaperAlt.Default.Apply(InStr, null);
            }

            return(Bypass(hdc, InStr, InStr.Count(), psize));
        }
        void SetupStepB(void *ESP)
        {
            if (FirstTry)
            {
                ShowMessageBox("SRL will now need your help to confirm if the dialogue has been found.\nThe program will display the game dialogue; when the correct dialogue is shown, press YES. If nothing is shown or if you see corrupted text, press NO.\nTake note that if you don't set the proper game encoding inside SRL.ini, the correct dialogue will most likely never be shown.\nPress OK if you have read and understood the above.", "StringReloads Setup Wizard", MBButtons.Ok, MBIcon.Information);
            }

            if (WaitingConfirmation)
            {
                WaitingConfirmation = false;
                var Rst = ShowMessageBox("And then, you saw the confirmation message?", "StringReloads Setup Wizard", MBButtons.YesNo, MBIcon.Question);
                if (Rst == MBResult.Yes)
                {
                    FinishSetup();
                }

                WaitingConfirmation = false;
            }

            uint *Stack       = (uint *)ESP;
            int   StackOffset = LastOffset;

            while (StackOffset < 50)
            {
                var RStack = (Stack + StackOffset);
                if (IsBadCodePtr((void *)*RStack))
                {
                    Log.Trace($"Bad Pointer: 0x{*RStack:X8}");
                    StackOffset++;
                    continue;
                }

                Log.Trace($"Guessing Offset: 0x{(uint)RStack:X8} (+{StackOffset}) (0x{*RStack:X8})");
                CString Str = (byte *)*RStack;
                if (Str.Count() > 0 && Str.Count() < 500)
                {
                    var Reply = ShowMessageBox(Str, "Is this the dialogue?", MBButtons.YesNo, MBIcon.Question);
                    if (Reply == MBResult.Yes)
                    {
                        Str = "Looks Like everything is working,<br>Continue to the next game dialogue!";
                        *RStack = (uint)(void *)Str;
                        WaitingConfirmation = true;
                        break;
                    }
                }

                StackOffset++;
                continue;
            }

            LastOffset = StackOffset;

            if (StackOffset == 50)
            {
                SetupFailed();
            }


            if (FirstTry)
            {
                FirstTry = false;
                ShowMessageBox("Very well, SRL will now try translating the game text to test settings.\nIf you don't see a message in-game confirming what has been set, then continue on to the next in-game dialogue and press NO; otherwise, press YES.", "StringReloads Setup Wizard", MBButtons.Ok, MBIcon.Information);
            }
        }