Code Monkey home page Code Monkey logo

Comments (7)

NTxC avatar NTxC commented on June 7, 2024

I got this so far and it works, but the loading tune is forcibly stopped when the menu is supposed to show up anyway. I assume it's because of a call to stop the audio somewhere, but I can't figure out exactly where.

if( bSkipIntroJingle )
    {
        //                             S  T  A  R  T  I  N  G  _  T  U  N  E 
        auto pattern = hook::pattern( "53 54 41 52 54 49 4E 47 5F 54 55 4E 45 00" );

        //                             L  O  A  D  I  N  G  _  T  U  N  E 
        //                             4C 4F 41 44 49 4E 47 5F 54 55 4E 45 00 00
        injector::WriteMemory( pattern.get_first( 0 ), 0x44414F4C, true ); // change the string from STARTING_TUNE to LOADING_TUNE
        injector::WriteMemory( pattern.get_first( 4 ), 0x5F474E49, true );
        injector::WriteMemory( pattern.get_first( 8 ), 0x454E5554, true );
        injector::WriteMemory<uint16_t>( pattern.get_first( 12 ), 0x0000, true );

        // skip replaying the loading tune
        pattern = hook::pattern( "8B 8C 24 94 00 00 00 5E 5B 33 CC" );  // end of function before target function
        injector::WriteMemory( pattern.get_first( 40 ), 0x00FFFFB8, true ); // mov eax, -1
        injector::WriteMemory<uint16_t>( pattern.get_first( 44 ), 0xC300, true ); // ret
    }

from gtaiv.eflc.fusionfix.

NTxC avatar NTxC commented on June 7, 2024

I managed to get it to work. Frontend noises will cancel the loading tune, so I made it so that the hidden menu doesn't make a noise after the GTA IV logo. The following code does the job, testers welcome.

    if( bSkipIntroJingle && bSkipMenu )
    {
        //                             S  T  A  R  T  I  N  G  _  T  U  N  E 
        auto pattern = hook::pattern( "53 54 41 52 54 49 4E 47 5F 54 55 4E 45 00" );

        //                             L  O  A  D  I  N  G  _  T  U  N  E 
        //                             4C 4F 41 44 49 4E 47 5F 54 55 4E 45 00 00
        injector::WriteMemory( pattern.get_first( 0 ), 0x44414F4C, true ); // change the string from STARTING_TUNE to LOADING_TUNE
        injector::WriteMemory( pattern.get_first( 4 ), 0x5F474E49, true );
        injector::WriteMemory( pattern.get_first( 8 ), 0x454E5554, true );
        injector::WriteMemory<uint16_t>( pattern.get_first( 12 ), 0x0000, true );

        // skip playing the loading tune the second time
        pattern = hook::pattern( "8B 8C 24 94 00 00 00 5E 5B 33 CC" );  // end of the function before the target function
        injector::WriteMemory( pattern.get_first( 40 ), 0x00FFFFB8, true );          // mov eax, -1
        injector::WriteMemory<uint16_t>( pattern.get_first( 44 ), 0xC300, true );    // ret

        // dont stop the loading tune after the GTA IV logo
        pattern = hook::pattern( "EB E7 68 3B 28 AA 3F B9 ? ? ? ? E8" );                          
        injector::WriteMemory<uint16_t>( pattern.get_first( 17 ), 0xC030, true );   // xor al, al
    }

The end result: youtube video

from gtaiv.eflc.fusionfix.

sTc2201 avatar sTc2201 commented on June 7, 2024

@NTxC I noticed that the signatures for this patch are for Complete Edition, at least the last 2 ones. I was trying to implement it into the pre-ivce branch which supports v1.0.8.0 and below. I found the signatures for v1.0.8.0 but it keeps throwing the assertion failed error when booting up the game. I was able to trace it back to the pattern.get_first method

    if (bSkipIntroJingle)
    {
                                        /*S  T  A  R  T  I  N  G  _  T  U  N  E*/ 
        auto pattern = hook::pattern("53 54 41 52 54 49 4E 47 5F 54 55 4E 45 00");

                                        /*L  O  A  D  I  N  G  _  T  U  N  E */
                                        /*4C 4F 41 44 49 4E 47 5F 54 55 4E 45 00 00*/
        injector::WriteMemory(pattern.get_first(0), 0x44414F4C, true);             // change the string from STARTING_TUNE to LOADING_TUNE
        injector::WriteMemory(pattern.get_first(4), 0x5F474E49, true);
        injector::WriteMemory(pattern.get_first(8), 0x454E5554, true);
        injector::WriteMemory<uint16_t>(pattern.get_first(12), 0x0000, true);

        // skip playing the loading tune the second time
        pattern = hook::pattern("8B 8C 24 94 00 00 00 5F 5B 33 CC");              // end of the function before the target function
        injector::WriteMemory(pattern.get_first(40), 0x00FFFFB8, true);         // mov eax, -1
        injector::WriteMemory<uint16_t>(pattern.get_first(44), 0xC300, true);   // ret*/

        // dont stop the loading tune after the GTA IV logo
        pattern = hook::pattern("00 00 68 3B 28 AA 3F B9 ? ? ? ? E8 19 67 45 00 84 C0");
        injector::WriteMemory<uint16_t>(pattern.get_first(17), 0xC030, true);   // xor al, al
    }

This is the updated code with the two v1.0.8.0 signatures below, the last signature might be overkill, not really sure about that. STARTING and LOADING_TUNE strings signatures have not been changed since 1.0.8.0.
Hope you can help me figure out what's wrong with it.

from gtaiv.eflc.fusionfix.

NTxC avatar NTxC commented on June 7, 2024

@sierratangocharlie26 The assertion errors may show up if the patterns haven't been found in the memory. Haven't had more time to look into it yet, but this one was sticking out. The last pattern in your version of the code:

pattern = hook::pattern("00 00 68 3B 28 AA 3F B9 ? ? ? ? E8 19 67 45 00 84 C0");

seems to be hardcoding the target CALL address (the four bytes after E8). Remember that the executable is relocatable in the memory, so you have to assume that the target CALL address might be different every time, so you must use the question marks instead, like this:

pattern = hook::pattern("00 00 68 3B 28 AA 3F B9 ? ? ? ? E8 ? ? ? ? 84 C0");

Edit: nevermind, looks like that CALL is relative. Still wouldn't risk it with the hardcoded one, though, as the relative offset may be different for different versions of gtaiv.exe. I wrote my code using v1.2.0.43.

from gtaiv.eflc.fusionfix.

sTc2201 avatar sTc2201 commented on June 7, 2024

@NTxC I just realised that this

        // skip playing the loading tune the second time
        pattern = hook::pattern("8B 8C 24 94 00 00 00 5F 5B 33 CC");              // end of the function before the target function
        injector::WriteMemory(pattern.get_first(40), 0x00FFFFB8, true);         // mov eax, -1
        injector::WriteMemory<uint16_t>(pattern.get_first(44), 0xC300, true);   // ret

won't work for v1.0.8.0 since it will be the start a completely different function, the desired function is at another location.
I think for now I'm trying to solve the issue that it can't even change STARTING_TUNE string to LOADING_TUNE because of aforementioned assertion failure. If I comment out the write memory stuff it works fine so I assume the pattern hooking has no issues (?).

I have to mention that I'm relatively new to this topic, I only did little patches in other games and I'm also not really familiar with the methods such as get_first etc. yet.

from gtaiv.eflc.fusionfix.

sTc2201 avatar sTc2201 commented on June 7, 2024

@NTxC I found the correct signatures for the two bottom patches for v1.0.8.0 and it works, yet, for some unknown reasons it simply can't find the signature of the STARTING_TUNE string. I tried to check the size of the pattern and it seems it's empty so I assume it just can't find it at all on v1.0.8.0. I still managed to make it work although it requires editing the sounds.dat15 file in the audio configs replacing the LOADING_TUNE there, pretty much the same procedure like in your implementation if you ask me, but not as elegant.

Anyway here's the code with the 1.0.8.0 signatures in case you (or someone else) are interested:

        // skip playing the loading tune the second time
        auto pattern = hook::pattern("50 E8 ? ? ? ? 5E 5F 83 C4 48 C3");            // end of the function before the target function
        injector::WriteMemory(pattern.get_first(13), 0x00FFFFB8, true);             // mov eax, -1
        injector::WriteMemory<uint16_t>(pattern.get_first(17), 0xC300, true);       // ret

        // dont stop the loading tune after the GTA IV logo
        pattern = hook::pattern("E9 16 07 00 00 68 3B 28 AA 3F B9 ? ? ? ?");
        injector::WriteMemory<uint16_t>(pattern.get_first(20), 0xC030, true);       // xor al, al

I really have no clue at this point why it couldn't find the signature of that string, maybe one day someone will find the solution for this.

from gtaiv.eflc.fusionfix.

afree117 avatar afree117 commented on June 7, 2024

@NTxC @sTc2201 Old feed, but how would I implement this code into the game? I'm still learning as I go, but seeing this and the YT video are how I remember it beginning and I am working to make it as close to original as possible.

from gtaiv.eflc.fusionfix.

Related Issues (20)

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.