Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

Sign in to follow this  
Demarest

DARKPACT level III VC

Recommended Posts

Demarest

Apologies that this development comes so rapidly after level 2. Level III manuevers within Darkpact's final barrier: starting a new game. Now Darkpactors can represent a one step release for a mod and can be used at any point in the game, period. The jump to level III is also Y_Less's contribution. I had a method worked out, but it was errouneous. His is sound and actually rather exandable with little effort and quite easy to document smile.gif No download required, just VC's original main.scm and Barton Waterduck's Mission Builder 0.22 for VC.

 

We start as before by modifying the Firefighter sniff thread so that our code will auto-launch. UNlike previous Darkpacts, level III uses Mission 1 instead of Mission 0. Like before, search from the beginning of original code for the word firefighter and page up, looking for address F211. Insert the following code, then comment the first if line and jump if false line like so

0417: start_mission  1?

0002: jump ��Label00F211

 

before after

 

user posted imageuser posted image

 

Now, Mission 1 is going to be stacked. That is it is going to be responsible for both Mission 1 as well as Darkpact level III. Misison 1 indicates that it is finished by setting flag 880??. So we start by checking to see if 880?? is NOT 0, at which point our code can assume the mission is being called to run Darkpact and not the opening cutscene. If it IS 0, then the user just started a new game and we'd like it to run the original Mission 1 ONLY. So after the name_thread command, add the following code. If you are Darkpacting previously Darkpacted code, just add your create_threads after the existing ones as diagrammed below and be sure to up the 124?? equals line to indicate the amount of create_threads there. This is different than before because before, you could set 124?? to any arbitray value you wanted whereas now, it HAS to indicate the amount of mods it currently carries.

00D6: if  0?

8038:  NOT    880?? ==  0?  \\ integer values

004D: jump_if_false �LabelNEWGAMECONTINUE

0004:  368?? = 33588224&&

0004:  372?? = 100856341&&

0004:  376?? = 20736&&

0004:  96?? = 262358&&

0050: gosub 369&&

0008:  372?? +=  4?

0004:  96?? = 134349398&&

0050: gosub 369&&

0008:  372?? +=  4?

0004:  96?? = 16796928&&

0050: gosub 369&&

0008:  372?? +=  4?

0004:  96?? = 62397&&

0050: gosub 369&&

008B: [email protected] = 124??

0012: [email protected] *= -8?

000A: [email protected] += �DARKPACTOR

0050: gosub [email protected]

004E: end_thread

 

:DARKPACTOR

004F: create_thread ��DARKPACTLEVEL3MOD1

0004: 124?? = 1?

0051: return

 

:LabelNEWGAMECONTINUE

 

Darkpacting original code Darkpacting Darkpacted code

OR multiple mods simultaneously

 

user posted imageuser posted image

 

This code is designed to use 4 abandoned DMA slots and incorporate a combination of Y_Less's VMA (variable memory access) and self-modifying code techniques. Essentially, it repairs the FF sniff thread to its original state so that it won't try to launch Mission 1 repeatedly. The repair is in memory though, so subsequent loads will run it also. That's why we use 124?? to control the mod selection. It uses CyQ's array technique so that it will only run the create_threads it needs to and none that it doesn't. This paves the way for ALL mods to be injected into a new game, mods to be injected into a savegame, or new mods added to a previously Darkpacted SCM. You just have to be sure that you add create_threads after the existing one(s) as shown above and add the mods to MAIN in the SAME ORDER as the create_threads as shown below. Then be sure that the 124?? equals line is equal to the exact amount of create_threads there, as circled above. Now you'll need to put your (new) mod(s) after all the other code in main as seen in the pics below.

 

Darkpacting original code Darkpacting Darkpacted code

OR multiple mods simultaneously

 

user posted imageuser posted image

 

Next, we consider that Misison 1 is a bunch of cutscenes and therefore would give the FF thread a zillion chances to launch a Misison 1 when somebody started a new game. So instead of leaving the create_thread in MAIN, we'll make it the very last command in Mission 1. So search from the beginning for the start of Misison 1, then search for end_thread, and add the following code like so.

004F: create_thread ��Label00F207

 

before after

 

user posted imageuser posted image

 

However, we cannot just pluck that same create_thread out of MAIN or else we'd sacrifice savegame compatibility, so we must pad MAIN in its place. I recommend commenting it out to remind us that it was present originally. create_threads have added potential of passing a thread data, so they have a termination byte that makes them 8 bytes instead of 7. *Note that Darkpact does NOT support such create_thread commands in the Darkpact section of Mission 1, but since they're only used to pass data from one thread to another, they won't be needed. Anyways, my favorite 7 byte padding is 0006: [email protected] = 1? because it will not impact any thread that isn't using 2 thread counters, so we just up the value from a byte to a word to make it that extra byte like so.

0006:  [email protected] =  128&

 

before after
user posted image user posted image
You're done. Compile your code and now your mod is avaible as a Darkpactor that is one-step plug and play and fully provisioned for a new game. colgate.gif Keep in mind that original code has 102 usable holes in memory. This means up to 102 Darkpacted globals into any one SCM. For the sake of other authors, use locals where possible. Also be sure your mods use the name_thread command since Darkpacting may also provoke the need for mod killers which is a very easy step from here. Going back to globals, the 102 DMA slots are documented but DO NOT use their DMA addresses, but rather allow Mission Builder to allocate them to avoid collisions between codes.

 

Why the move to Mission 1? Since the remainder of original main.scm is included, Mission 1 is used because it is some 14,000 bytes while Mission 0 is some 31,000 bytes with the limit being 35,000. Since Uniquecall is around 9,000 bytes and must reside in a mission, the extra space has already been helpful. My apologies that Barton's use of the pound symbol does not parse correctly on GTAF any longer. I've brought this up in Network, but it has been largely overlooked confused.gif

Edited by Demarest

Share this post


Link to post
Share on other sites
Demarest

Y_Less pointed out a slight flaw and a way to correct it that would make it even easier for authors working with multiple injected mods. Revised topic and images. You may need to refresh the page for the new images to show up if you've previously viewed the original release. The major change was that the if 124?? equals check was removed as in the event of multiple Darkpactings, a new game would only inject the newest mod or mod set, but still have the MAIN padded with previous mod codes. CyQ's array technique was employed to ensure that under any and all circumstances, mods not yet injected will get injected while those already injected are left as is. This only requires a Darkpactor author make sure that create_threads already present in Darkpact's section of Mission 1 are left and anything they add to it come after it and that they reflect the total number of create threads present in the 124?? equals line.

 

Also, I was wrong when I originally suggested that MB might not be able to decompile Y_Less's self modifying code. The difference is that

0050: gosub 369&&
...is decompiled as
0050: gosub ££Label000171

If you are Darkpacting a previously Darkpacted SCM, be sure to replace all gosub ££Label000171's with gosub 369&&'s before compiling. If you forget, don't worry; MB will remind you wink.gif

Share this post


Link to post
Share on other sites
Y_Less
Just so people know, I have tested this with adding mods and new games and it runs fine.

Share this post


Link to post
Share on other sites
El_Venezolano
Wow, great job, I just tryed it my self. colgate.gif

Share this post


Link to post
Share on other sites
Y_Less

I have no idea how this was missed before but there is a major and fatal flaw in this - it doesn't work on a new game, it tries to run 2 missions at once AND it writes the wrong data, with both those errors I have no idea at all how it ever worked! (The second error meant it would only crash if you were arrested/ died or went into a cutscene, the first would crash almost the moment you started a new game. Fortunately I have fixed both:

 

First change your FIRE thread (search for 'FIRE' - it's the first result).

 

 

From:

 

:Label00F20703A4: name_thread "FIRE":Label00F2110001: wait  0? ms      00D6: if  0?0256:   player $PLAYER_CHAR defined004D: jump_if_false ££Label00F3BD00D6: if  0?00DE:   player $PLAYER_CHAR driving_vehicle_type #FIRETRUK004D: jump_if_false ££Label00F3A200D6: if  1?0038:   $ONMISSION ==  0?  \\ integer values0038:    1284?? ==  0?  \\ integer values004D: jump_if_false ££Label00F39B0293:  72?? = current_controls00D6: if  0?0038:    100?? ==  1?  \\ integer values004D: jump_if_false ££Label00F2AE00D6: if  0?0038:    1280?? ==  0?  \\ integer values004D: jump_if_false ££Label00F2AE00D6: if  0?8038:   NOT    72?? ==  3?  \\ integer values004D: jump_if_false ££Label00F29D03E5: text_box "FTUTOR" \\ Press the ~h~~k~~TOGGLE_SUBMISSIONS~ button~w~ to toggle fire truck missions on or off.0002: jump ££Label00F2A7

 

To:

 

:Label00F20703A4: name_thread "FIRE":Label00F2110001: wait  0? ms      00D6: if  1?0038:   $ONMISSION ==  0?  \\ integer values0038:    1284?? ==  0?  \\ integer values004D: jump_if_false ££Label00F39B0417: start_mission  1?0002: jump ££Label00F211;00D6: if  0?0256:   player  $player_char defined;004D: jump_if_false ££Label00F3BD00D6: if  0?00DE:   player $PLAYER_CHAR driving_vehicle_type #FIRETRUK004D: jump_if_false ££Label00F3A20293:  72?? = current_controls00D6: if  0?0038:    100?? ==  1?  \\ integer values004D: jump_if_false ££Label00F2AE00D6: if  0?0038:    1280?? ==  0?  \\ integer values004D: jump_if_false ££Label00F2AE00D6: if  0?8038:   NOT    72?? ==  3?  \\ integer values004D: jump_if_false ££Label00F29D03E5: text_box "FTUTOR" \\ Press the ~h~~k~~TOGGLE_SUBMISSIONS~ button~w~ to toggle fire truck missions on or off.0002: jump ££Label00F2A7

 

This will stop the game running 2 missions at once while maintaining compatibility.

 

Now the new Darkpact code for mission 1:

 

 

00D6: if  0?8038:  NOT    880?? ==  0?  \\ integer values004D: jump_if_false £LabelNEWGAMECONTINUE0004:  368?? = 33588224&&0004:  372?? = 1610805806&&0004:  376?? = 20736&&0004:  96?? = 262358&&0050: gosub 369&&0008:  372?? +=  4?0004:  96?? = 134349398&&0050: gosub 369&&0008:  372?? +=  4?0004:  96?? = 16796928&&0050: gosub 369&&0008:  372?? +=  4?0004:  96?? = 62397&&0050: gosub 369&&008B: [email protected] = 124??0012: [email protected] *= -8?000A: [email protected] += £DARKPACTOR0050: gosub [email protected]: end_thread:DARKPACTOR            \\ Put your "create_thread" commands here.004F: create_thread ££SCMCheatProcessor\\ Set this to the number of create_thread lines above.0004: 124?? = 1?                             0051: return:LabelNEWGAMECONTINUE

 

 

This is updated to reflect the move of code in the FIRE thread and to repair the original bug. The original code writes from 96?? (0x60) but the HEX uses 0x6.

Edited by Y_Less

Share this post


Link to post
Share on other sites
Herne

There is a problem with the code in the first post, the create_thread command does not work.

It says

004F: create_thread ��DARKPACTLEVEL3MOD1

It should be

004F: create_thread ��LABELDARKPACTLEVEL3MOD1

This stops the scm from compiling with the error "Label not found: :LabelDARKPACTLEVEL3MOD1:"

 

Having sucesfully compiled main.scm with darkpact, i tried to load one of my origional save games and got an unhandled exeption, I don't reallly understand what i am supposed to do once i've compiled darkpact, is there a guide somewhere which i havn't found?

Share this post


Link to post
Share on other sites
Demarest

If one command says LabelX, then the label must actually be called LabelX. Whereas if a command just refers to X, then the label must also be just X. They have to match. If you're getting an error, it's because they don't match or you simply don't have a label by that name at all.

 

Once you've compiled your SCM, it's considered to be original+yourmod. You replace your original SCM with the original+yourmod and it should load just fine. I'm assuming the SCM you were using to make the saves in question is the same SCM you used as a foundation for the Darkpacted version? That's a must.

Share this post


Link to post
Share on other sites
Herne

Yes they were both standard unmodified scm's. I even tried with a downloaded 100% savegame.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.