Jump to content

TFTD extender (alpha)


kyrub

Recommended Posts

Tomorrow night at the very best, I have a got a Maelstrom of a work now.

 

Wow, can I use it? All wrapped up, just put it in etc.? Nice work, Tycho.

 

Be my guest! Let me know if there is anything else to look for. I guess I know the sound subroutines for EU pretty good only because it took so much effort to locate the bomber-zombie issue.

 

What are you using to assemble the scripts into an executable? I would like to experiment with modifying the loader for myself (at first). I could have included the actual fire interval for weapons if I have been able to inject a script instead of trying to rearrange the actual code.

Link to comment
Share on other sites

  • Replies 78
  • Created
  • Last Reply

Top Posters In This Topic

Here is my first attempt at some of the coding. I know the values are correct but check the scripting. Feel free to include this as well. Finding these values was my biggest accomplishment to date in deciphering the assembly.

 

if(INI_READ_INT("Mod","DUP torpedos for cannons at start",0))

{

char patch[]={0x03};

PatchInPlace(0x43F152,patch,1); //set ammo amount for DUP torpedoes

char patch2[]={0x01};

PatchInPlace(0x43F159,patch2,1); //set r-slot as DUP torpedo launcher,sub1

PatchInPlace(0x43F18C,patch2,1); //set r-slot as DUP torpedo launcher,sub2

char patch3[]={0x00,0x00,0x00};

PatchInPlace(0x4798BA,patch3,3); //remove cannon and DUP launchers in base store

char patch4[]={0x00};

PatchInPlace(0x4798C8,patch4,1); //remove cannon rounds in base store

char patch5[]={0x13}; //extra DUP torpedos for diff in prices

PatchInPlace(0x4798C6,patch5,1);

}

Edited by Tycho
Link to comment
Share on other sites

I'm not exactly proficient with the language used here, but if it's anything like what I'm used to, you won't be able to redefine "patch" as a char over and over again like that. Will probably be fine if you just remove all use of "char" except for the first instance.

 

You also shouldn't need to redefine the contents of "patch" unless the next value to write will be different; that is to say, you can remove the second line that sets it to {0x01} because, well, it already was.

 

If C handles char anything like how Java handles char (only lets you put valid characters into it), you will not want to use it here. Go with "byte" or something like that if so.

 

I gather "sizeof(patch)/sizeof(char)" should return the amount of values in the array, saving you having to add them up manually with larger patches.

 

But as mentioned above, I'm no C expert (I'm only even guessing this is C, so all of the above could be hogwash!), really I'm posting this to ask: can anyone explain to me what's with the 4 in the addresses? Like, 0x4798C6? It's been bugging me ever since I first saw it done, and it drives me mad with curiosity each time I see it! :blush:

Link to comment
Share on other sites

I'm not exactly proficient with the language used here, but if it's anything like what I'm used to, you won't be able to redefine "patch" as a char over and over again like that. Will probably be fine if you just remove all use of "char" except for the first instance.

 

You also shouldn't need to redefine the contents of "patch" unless the next value to write will be different; that is to say, you can remove the second line that sets it to {0x01} because, well, it already was.

 

If C handles char anything like how Java handles char (only lets you put valid characters into it), you will not want to use it here. Go with "byte" or something like that if so.

 

I gather "sizeof(patch)/sizeof(char)" should return the amount of values in the array, saving you having to add them up manually with larger patches.

 

The layout and wording is exactly how seb has written all his scripts. Whatever language it is, it should work.

Thanks for pointing out that I didn't need to redefine the character unless the values changed. I edited it above.

 

But as mentioned above, I'm no C expert (I'm only even guessing this is C, so all of the above could be hogwash!), really I'm posting this to ask: can anyone explain to me what's with the 4 in the addresses? Like, 0x4798C6? It's been bugging me ever since I first saw it done, and it drives me mad with curiosity each time I see it! :blush:

 

As far as I understand, it has to do with the the file being a windows PE executable. When using IDA to disassemble the code it always starts from there and all the scripts by seb use this 4xxxxx convention for the offsets.

Link to comment
Share on other sites

  • 2 weeks later...
It seems so long as you disable the "more smoke" and "corrupt land sound" tweaks, this one is mostly functional as-is. Worth a try if you haven't already. :argh:

 

Are you able to access the sell or purchase menu? I keep crashing in those areas.

Link to comment
Share on other sites

This problem isn't related to any INI setting, so you simply can't open them with the loader active, full stop.

Sounds horrible, my apologies. Thanks for detecting it, BB and Tycho.

- I am drained from RL workload, lost any desire for extra programming or Terrain mod testing in consequence.

Link to comment
Share on other sites

It can wait; I still think the overall package is pretty awesome as-is. :D

 

Won't stop me from piling up the laundry list in the meantime though. :argh:

 

To make the CE game work with XcomUtil, Scott made a tweak to the game exe that let you run it via two copies - a "tactical" version and a "geoscape" version. He did this for both UFO and TFTD, but the TFTD patch is somewhat broken... it forces a crash whenever either executable exits, pretty much guaranteed.

 

If the game could be made to exit cleanly that'd be pretty cool, as at the very least it disrupts the flow of gameplay. If you don't already know what I'm on about, just shout and I'll provide more info.

Link to comment
Share on other sites

  • 3 weeks later...

I found a solution to the problem with the crashes on the sell and purchase screens. The problem is two-fold: The source of the error is in the bug fix for the dismantle base facility crash. However, the INI file has a problem in that the enabled by default fixes are not under the proper heading so the loader runs them by default even if you set any of them to zero. Copy the following over the appropriate sections in the INI file should fix that problem and avoid the crash on the purchase/sell screen.

 

 

[bug Fix]

; bug fixes by default:

No research impasses=1

Phantom Radar=1

Elerium-fueled Craft Bug=1

Personnel Overflow=1

Base Facility Dismantle-Construction Crash=0

Transfered Crafts Refueled=1

Door Jam=1

Hostile Civilians=1

Collectors Edition Blaster Bomb Bug=1

Crash On First Move=1

Proximity Grenades=1

Base Disjoint=0

 

; bugs that have an impact on game mechanics

Hallucinoid Ranged Attack=0

Set BioDrone Melee Accuracy=0

Radar Stacking=0

Underwater weapons reaction fire=0

Funky Fire=0

 

[Annoying]

Sea Floor Terrain Variety=1

Corrupted Background Land Sound=0

Cannot Intercept Over Land Message=1

Mission Too Deep Glitch=1

Single Stage Ship Missions=0

Fewer Ship Terror Missions=0

See Last Alien After 60 Turns=0

Deep One Research Unlock=0

;if true, any live alien terrorist will substitute Deep One

 

[Obvious Flaws]

More Smoke=0

Reorder Soldiers In Crafts=1

De-equip Crafts=1

Retaliate Against Ground Assault=0

Manual Interception Fire Mode=0

 

[Technical issues]

Video Pitch=1

Music Change Freeze=0

Tactical Scroll=0

Animations Speed=0

HQ4x=0

D3D=0

D3D Windowed=0

Always On Top=0

Clip Cursor=0

Scale Mouse=0

Screen Ratio=0.833333

Max FPS=0

Link to comment
Share on other sites

XCOM:EU refueled my interest for UFO and especially TFTD (since I always liked the latter better). But I didn't manage to run the game in a playable way on my current PC until I found out about TFTD extender, so I'm very interested to bring that tool from alpha state to a version that is stable, so I post my observations here.

 

There is a crash at 451DA8 whenever my Triton arrives at a crash site and I click on the button to start the mission. That crash doesn't happen anymore when I set Sea Floor Terrain Variety=0.

 

There is also a crash at 460917 when an interception is aborted because the alien sub is too deep. Since that is a bit hard to reproduce I haven't found out yet what to do against that crash.

Link to comment
Share on other sites

Here is my first attempt at some of the coding. I know the values are correct but check the scripting. Feel free to include this as well. Finding these values was my biggest accomplishment to date in deciphering the assembly.

 

if(INI_READ_INT("Mod","DUP torpedos for cannons at start",0))

{

char patch[]={0x03};

PatchInPlace(0x43F152,patch,1); //set ammo amount for DUP torpedoes

char patch2[]={0x01};

PatchInPlace(0x43F159,patch2,1); //set r-slot as DUP torpedo launcher,sub1

PatchInPlace(0x43F18C,patch2,1); //set r-slot as DUP torpedo launcher,sub2

char patch3[]={0x00,0x00,0x00};

PatchInPlace(0x4798BA,patch3,3); //remove cannon and DUP launchers in base store

char patch4[]={0x00};

PatchInPlace(0x4798C8,patch4,1); //remove cannon rounds in base store

char patch5[]={0x13}; //extra DUP torpedos for diff in prices

PatchInPlace(0x4798C6,patch5,1);

}

That sounds like you got your hands on the TFTD extender source code ... any chance I can get a copy of it too? On the net I can only find the original UFO extender source, but to translate that to TFTD is a loooot of work, and since kyrub has already done it obviously ... :)

Link to comment
Share on other sites

That sounds like you got your hands on the TFTD extender source code ... any chance I can get a copy of it too? On the net I can only find the original UFO extender source, but to translate that to TFTD is a loooot of work, and since kyrub has already done it obviously ... smile.png

 

Kyrub has the only "source code", which is just him taking UFO extender and converting it to TFTD. It's in alpha since there is a lot of work that needs to be done. The above code was a quick change from my mod in EU to those TFTD offsets.

Link to comment
Share on other sites

Kyrub has the only "source code", which is just him taking UFO extender and converting it to TFTD. It's in alpha since there is a lot of work that needs to be done. The above code was a quick change from my mod in EU to those TFTD offsets.

I see, thanks for the info.

 

Kyrub, if you still read this: do you intend to continue your work? If not, can someone else like me do it for you?

 

I already took the UFO extender source code and TFTD idc file and began translating. I'm about two thirds through with translating the addresses, but since TFTD is different in a lot of places quite a few of the UFO extender patches are not applicable in the exact same way, so a lot of testing would be needed after the translation. And while I have Visual Studio 2008 I do most of my work in C# (and a bit Java and some other high level languages), my C/C++ and assembly knowledge is some 20 years old (and the last time I seriously occupied myself with assembler was on the Amiga :)).

Link to comment
Share on other sites

I see, thanks for the info.

 

Kyrub, if you still read this: do you intend to continue your work? If not, can someone else like me do it for you?

 

I intended to finish it, but if you want to do it instead of me, it would actually be nice.

 

I will gladly give out my translated code, there is no secret about it, I took all from other people anyway. Also, the Ufo extender was po¨sted under GNU license, so I will give you what I did with extender.

 

Just to warn you:

- it was a mess before I got it from Seb76

- I made it into twice the mess, since I have 0 experience with C+

Link to comment
Share on other sites

I intended to finish it, but if you want to do it instead of me, it would actually be nice.

 

I will gladly give out my translated code, there is no secret about it, I took all from other people anyway. Also, the Ufo extender was po¨sted under GNU license, so I will give you what I did with extender.

 

Just to warn you:

- it was a mess before I got it from Seb76

- I made it into twice the mess, since I have 0 experience with C+

Thanks, I take the risk :)

 

I sent you a PM so that you can contact me directly.

 

While I won't make any promises since my time and my C++/assembler knowledge is limited, I take that as a challenge and hope that I can finish kyrub's work.

Link to comment
Share on other sites

To fix the crash with the Elerium (Zrbrite) fueled craft bug is enabled:

 

The offset to where you insert the fix needs to be changed to 0x445FEF. [you could hex-edit this value into patcher.dll . Offset 0x52E3~E4: EF 5F]

 

To fix the crash on clicking the purchase/sell buttons when you enable the dismantle-base-facility-bug fix:

Change the offset for the patch to 0x4458FD. [patcher.dll offset 0x535B~C: FD 58]

Edited by Tycho
Link to comment
Share on other sites

No hurry. I've been comparing EU and TFTD code to see what is different. A lot of it is almost the same. However, they did make some big changes to the sound routine. I'm still trying to understand how to fix the popping at the end of many of the sound files. It's not as simple as adding silence to the end of the sound selection...
Link to comment
Share on other sites

I passed this on to Blade a little while ago, but it looks like he might still be busy (either that or one of our email providers didn't like the attachment and decided to eat the message).

 

Anyway, if you extract it over a copy of XcomUtil 9.7 it adds support for TFTD Extender. You'll need to re-run the XCU setup script to enable it.

 

XcomUtil 9.7+TFTDLoader+Lightnin fix.zip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...