Esempio n. 1
0
        private void AddHooks()
        {
            _maingen.Clear();
            int loading = _maingen.DataByte(0x00);

            int gamehead       = WriteHead(_maingen, _game);
            int moviehead      = WriteHead(_maingen, _movie);
            int frontendhead   = WriteHead(_maingen, _frontend);
            int raceeditorhead = WriteHead(_maingen, _raceeditor);
            int carviewerhead  = WriteHead(_maingen, _carviewer);

            int game       = GenWrap(_maingen, loading, gamehead, off: 1);
            int movie      = GenWrap(_maingen, loading, moviehead);
            int frontend   = GenWrap(_maingen, loading, frontendhead, end: 0x02);
            int raceeditor = GenWrap(_maingen, loading, raceeditorhead);
            int carviewer  = GenWrap(_maingen, loading, carviewerhead);

            _hook = _maingen.Install(_mc2);
            InstallJmp(_game, game);
            InstallJmp(_movie, movie);
            InstallJmp(_frontend, frontend);
            InstallJmp(_raceeditor, raceeditor);
            InstallJmp(_carviewer, carviewer);

            _loading            = new MemoryWatcher <byte>(_hook);
            _loading.OnChanged += On_Loading;
            _memory.Add(_loading);

            _disclaimer            = new MemoryWatcher <byte>(_baseaddr + 0x2622B0);
            _disclaimer.OnChanged += On_Disclaimer;
            _memory.Add(_disclaimer);
        }
Esempio n. 2
0
 private static void GenPPO(X86Generator gen, IntPtr baseaddr, int codeoff, int stroff)
 {
     gen.Clear();
     gen.SetInstall(baseaddr + codeoff);
     gen.PushReg(X86Generator.Registers.ESI);
     gen.PushR(baseaddr + stroff);
 }
Esempio n. 3
0
 private void InstallJmp(X86Generator ingen, int hookoff)
 {
     _jmp.Clear();
     _jmp.SetInstall(ingen.GetInstall());
     _jmp.JumpR(_hook + hookoff);
     _jmp.WriteInstall(_mc2);
 }
Esempio n. 4
0
 private static void GenSPM(X86Generator gen, IntPtr baseaddr, int codeoff)
 {
     gen.Clear();
     gen.SetInstall(baseaddr + codeoff);
     gen.SubRI(X86Generator.Registers.ESP, 0x28);
     gen.PushReg(X86Generator.Registers.ESI);
     gen.MovRR(X86Generator.Registers.ESI, X86Generator.Registers.ECX);
 }