Topic: Hex Editing of Starfleet executables  (Read 78908 times)

0 Members and 1 Guest are viewing this topic.

Offline xeryx

  • Lt. Junior Grade
  • *
  • Posts: 50
Re: Hex Editing of Starfleet executables
« Reply #660 on: January 19, 2017, 11:23:13 am »
Quote
I wouldn't use the Vessel Library to test a campaign because it can't view the campaign shiplist in MetaAssets, only the one in Assets\specs, which may be different.

That is simply not true while in the campaign, it will as long as both ships lists are the same, which both of mine are.  You can right click on a ship in the auction and see its stats.  It will not work if there are different ships lists, which you may have.  I keep mine the same when modding.  These are also the normal settings in the assets.gf file, that everyone else would have.  Which also brings me to this conclusion, that Taldren has 2 of the same ships lists for a reason and it wasn't to be able to play 2 different games.  That is just something someone else found out later on, by editing the assets.gf file.  Otherwise, Taldren would have made the assets.gf file the way you have it, is that not a correct assumption?  I now you have a heavily modded game and all, but many of us do not. 

You are not reproducing the same conditions that I have, if your settings are not the same, and that maybe why you are not seeing the same thing I am.

BTW: When I change Base year to Zero this is what my campaign displays for a year on the late campaign a 10, and that is not the way I want my game. I want the year to display properly (2253) and not cause issues with ship availability.  Do you even display the year properly in your campaign? like 2263 or is it 0? Tonight, I will change the assets file to see if it makes a difference.

Code: [Select]
[Clock/StartingDate]
BaseYear = 0
0 = 0
1 = 10
2 = 25
3 = 40

You may be onto something with having the base year as zero though in the Time.gf file. I fully understand how the YFA and YLA's in the ships list work as I have been working on it for a few months now, that is really pretty basic stuff.  My ships list YFA's are setup correctly, it wouldn't work otherwise. I also always save my ships list and fighter list from my masters to both files in the metaassets and the assets\specs directory.  I save my changes 3x when I make them so that my ships list are always the same version.

I think the best way to reproduce this error is to have someone else test as well.
« Last Edit: January 19, 2017, 03:34:13 pm by xeryx »

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #661 on: January 19, 2017, 01:52:09 pm »
You can right click on a ship in the auction and see its stats.

Wow. I did not know that. That's an easter egg for me. Ha. Anyway, the right-click will check the shiplist.txt, but in the wrong folder. It reads from ..\Assets\specs, never ..\MetaAssets. I might be able to hexedit this bug so that the campaign interface always reads from the specs in MetaAssets. Regardless, if your shiplists are identical, Xeryx, this shouldn't matter.

Testing...

Now I see why you were referencing the Vessel Library and why that was important to you for the campaign. "Date Introduced" would need to make sense. In a stock StarfleetOP.exe, 2263 is added to the YFA to produce the in-service date. If you add 10 to the YFA shiplist data and reduce the Date Intro from 2263 to 2253, what happens?

time.gf
BaseYear=0 //Y0.0
0=0 // YFA controllers
1=15
2=30
3=45

Date Introduced
2263 setup: R-Eagle YFA=-12 (2251) // available instantly in any era
2253 setup: R-Eagle YFA=-2 (2251) // still available instantly in any era because it is a negative number  :knuppel2:

2263 setup: R-Falcon YFA=-5 (2258) // available instantly in any era
2253 setup: R-Falcon YFA=5 (2258) // available in Y5.0

Better to use -100 Date Intro and +100 YFA, and fast-forward all the eras, right?

time.gf
BaseYear=0
0=85 // Early starts in 2248
1=100 // Mid starts in 2263
2=115 // Late starts in 2278
3=130 // Advanced starts in 2293

Date Introduced=2163
R-Eagle YFA=88 // available in Y88.0 (2163+88=2251)
R-Falcon YFA=95 // available in Y95.0 (2163+95=2258)

So you'd need to wait 3 years for that Eagle to arrive if you start in Early Era.
The Falcon would show up in ten years in that case.

I'll do more tests to confirm.

Offline xeryx

  • Lt. Junior Grade
  • *
  • Posts: 50
Re: Hex Editing of Starfleet executables
« Reply #662 on: January 19, 2017, 03:15:23 pm »
Quote
Now I see why you were referencing the Vessel Library and why that was important to you for the campaign. "Date Introduced" would need to make sense. In a stock StarfleetOP.exe, 2263 is added to the YFA to produce the in-service date. If you add 10 to the YFA shiplist data and reduce the Date Intro from 2263 to 2253, what happens?

I did this step, in my mod.  I added 10 years to the YFA so they show up on the proper dates. With the EXE set to 2253 and Time.gf file set to 2253..all the ships come out as scheduled.

My point is this, if the two Start dates are mismatched then ships will not arrive when they are supposed to (using the date in the campaign screen).

Please see the posts above for my results when you mismatch the numbers.

You only need to change the starting Date in the Time.gf to see the time shift. Use 2280 or something, or maybe a +10 year shift (as compared to the EXE) to see what I mean, and negative numbers in the ships list are not affected by this for the early era, however, if they have a YLA of anything other than 999 then they may not show up in certain eras.

The Start date in the EXE is the master game clock and is what the ships list uses so changing it is irrelevant.

« Last Edit: January 19, 2017, 03:57:00 pm by xeryx »

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #663 on: January 19, 2017, 03:18:24 pm »
I figured out the problem with Vessel Library. It always reads from ..\Assets\specs\shiplist.txt when you right-click on a ship's designation in the campaign interface. That is a bug which I might be able to fix. The singleplayer Dynaverse, however, always loads the files listed in ..\MetaAssets\ServerProfiles\SinglePlayer\assets.gf for shipyard production.

Name = "Assets"

[Files]
ShipSpecs      = ".\MetaAssets\Tar\shiplist.txt"
FighterSpecs   = ".\MetaAssets\Tar\ftrlist.txt"
CurMap   = ".\MetaAssets\MiddleMap.mvm"

This works for me. Try it out. Put a unique ship in there. It'll appear in the campaign shipyard. The path to shiplist.txt is not hardcoded.

Many people played on mPlayer/Gamespy and also played the singleplayer campaign with custom shiplists. We didn't right-click in a campaign on a ship designation because it would give a black screen (or we didn't even know that you could get into the Vessel Library). We didn't swap spec files everytime we wanted to play a free-for-all on mPlayer.

I don't know if the multiplayer Dynaverse can only read from ..\MetaAssets\shiplist.txt. There is no assets.gf file in MetaAssets\ServerProfiles\Multiplayer.

Offline Captain Adam

  • Lt.
  • *
  • Posts: 737
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #664 on: January 19, 2017, 03:50:50 pm »
Boy I'm confused so I will remain Seņor Lurker till you figure this out.  :crazy2:

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #665 on: January 19, 2017, 03:53:18 pm »
My point is this, if the two Start dates are mismatched then ships will not arrive when they are supposed to (using the date in the campaign screen).

You only need to change the starting Date in the Time.gf to see the time shift. Use a 10 year shift either way

The Start date in the exe is the master time, and is what the ships list uses so changing it is irrelevant.

Huh? The start date in the .exe is important. It is added to the YFA to show the in-service date in the Vessel Library.
I don't see a mysterious hardcoded ten-year shift. Can you get an 11-year shift? Can you get a 9-year shift?

I'm trying to understand your terms so I can see what you see.

I have used a BaseYear of zero and everything stays in sync in terms of YFA. No surprise, right? Once that is working properly, I add the cosmetic BaseYear that I want to the ticker, such as 2248. Then everything is accurate: Vessel Library, Ship Production, and Clock...no matter which era I start in.

StarfleetOP.exe clock = 2163

time.gf
BaseYear=2245
0=85 // Need not start at 0!
1=100
2=115
3=130

No problems.
Perhaps this is 6 of one, half-dozen of the other.  :o

Offline xeryx

  • Lt. Junior Grade
  • *
  • Posts: 50
Re: Hex Editing of Starfleet executables
« Reply #666 on: January 19, 2017, 04:26:30 pm »
I went and looked at my Assets.gf file

and this is what is says:

Quote
Name = "Assets"
[Paths]
Maps      = ".\MetaAssets\"
Scripts      = ".\Assets\Scripts\"
Campaigns   = ".\Assets\Scripts\Campaigns\"

[Files]
ShipSpecs      = ".\MetaAssets\shiplist.txt"
FighterSpecs   = ".\MetaAssets\ftrlist.txt"
CurMap   = ".\MetaAssets\MiddleMap.mvm"

This is exactly the way it is supposed to be Tar. Sure I could change the subdirectory to look at a different ships list or fighter list. That is still irrelevant as well, as you said "It should not matter as long as the files are the same." I may do this in the future, however, if I want to be able to switch back to original files.  There is probably a reason that the ships are displayed from the assets\specs folder for both the skirmish and campaign modes. 

That still is not the cause of the time being out of sync. The only cause is the Time.gf  being different from the EXE.  If it were as simple as just the ships not displaying the date correctly, I wouldn't care so much. However, it does affect when ships are produced and decommissioned. 

Are you 100% certain the files you are modding, are the same ones that are being used? I mean how many copies of the game do you have on the computer, and does the editing program you use remember what file it is.  For example I use notepad++ and it has a memory and I have to check to make sure I am editing the correct file if I have more than one copy of a game.  During my testing, I verified those files were the proper ones, plus I only have one copy of OP installed.

I have just installed a fresh copy of the game, and I will do some testing from it this weekend.

Don't worry about not seeing it man, focus on other important things. Besides this is more for modders wanting to change the game from the original. Which there probably is only 2 on this board..LMAO :D
« Last Edit: January 19, 2017, 04:49:25 pm by xeryx »

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #667 on: January 19, 2017, 04:43:42 pm »
OK. As long as you know how to keep the clocks working appropriately, that's good enough for me. I think there is more than one way to set things up and get the right results. A 2+3 = 1+4 sort of thing.

I'll look for the right-click shipyard link to Assets\specs\shiplist.txt. I'd like to fix that bug. I bet I can alter that to MetaAssets\shiplist.txt. It'll read the right campaign specs -- at least in the default location.

Offline xeryx

  • Lt. Junior Grade
  • *
  • Posts: 50
Re: Hex Editing of Starfleet executables
« Reply #668 on: January 19, 2017, 09:33:31 pm »
I'll look for the right-click shipyard link to Assets\specs\shiplist.txt. I'd like to fix that bug. I bet I can alter that to MetaAssets\shiplist.txt. It'll read the right campaign specs -- at least in the default location.

That sounds almost like a good idea, but ultimately, shouldn't that be specific for the campaign game?  Is it the same call for the vessel library?  Plus then it wouldn't work right for you unless you replace your default shipslist in the metaassets directory.

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #669 on: January 19, 2017, 11:27:48 pm »
I'll look for the right-click shipyard link to Assets\specs\shiplist.txt. I'd like to fix that bug. I bet I can alter that to MetaAssets\shiplist.txt. It'll read the right campaign specs -- at least in the default location.

That sounds almost like a good idea, but ultimately, shouldn't that be specific for the campaign game?  Is it the same call for the vessel library?  Plus then it wouldn't work right for you unless you replace your default shipslist in the metaassets directory.

I found the functions tonight. I can modify the hardcoded paths. The game always loads the shiplist.txt found in Assets\Specs into the Vessel Library. So this is why Dynaverse players instruct you to maintain duplicates of your specs in MetaAssets and Assets\Specs. I am sure that Taldren wanted these specs to be independent -- but they only got 4/5ths of the way there. The game will correctly load the campaign specs for Dynaverse production or the skirmish specs for a free-for-all, but the game isn't smart with Vessel Library data. The game loads the correct ftrlist.txt for spacedock in each mode too. So close.

I cannot change the shiplist that is read by the Vessel Library from the campaign window without messing up the Skirmish Mode. There is no obvious function to determine if you're in a campaign or a skirmish. Nope, the right-click just calls the shiplist from Assets\specs and we can take it or leave it.  :buck2:

We can, however, completely forget about the traditional Dyna spec files in MetaAssets. If we change the MetaAssets\ServerProfiles\SinglePlayer\assets.gf to...

[Files]
ShipSpecs      = ".\Assets\specs\shiplist.txt"
FighterSpecs   = ".\Assets\specs\ftrlist.txt"

...then everything is accurate everywhere. You have exactly one set of specs.

But if you want to play with a modded shiplist on GameRanger or EvolveHQ you'd need to swap those two text files. A tiny batch file works well for that.

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #670 on: January 20, 2017, 05:26:56 am »
I'm working on the PPD damage estimator. Taldren simply stuck three identical copies of a function into getAverageDamage(), getMinimumDamage(), and getMaxDamage().

Each of these functions takes one argument (the range bracket, as a byte). So that's all the outside data I have. With this I decided to make the mimimum damage zero with a fldz. There is a 1% chance that a PPD will miss with all four pulses at range 4 to 10, so putting a zero in there is valid!

I created two new arrays of bytes that contain the max and average damage of a standard PPD while remaining in a bracket for 4 pulses, and linked them to the respective estimators.

I tested this in game and I like it a lot. The PPD's don't show that misleading 5-5(5) data anymore. I am not yet able to adjust this estimator for Overloaded or Underloaded mode. These functions do not receive any bytes that would indicate the mode chosen. I figured that puzzle out. So the PPD estimator will work for UL, OL, and normal modes. :-)

              ------------------------Range---------------------------
             |   4-10*  11-15   16-20   21-25   26-30   31-40
Damage |     6          5           4         3          2         1
Accuracy|    83%     72%     58%    42%     28%    17%
Max       |     24       20         16       12         8         4
Avg       |     22       18         13        8          4         1
UL-Max  |     12       10          8         6          4         2
UL-Avg  |     10        8           5         3          1         0
OL-Max  |     36       NA        NA       NA       NA      NA       
OL-Avg  |     34       NA        NA       NA       NA      NA
*Range 8 is limit for OL
« Last Edit: February 08, 2017, 03:53:34 am by TarMinyatur »

Offline Captain Adam

  • Lt.
  • *
  • Posts: 737
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #671 on: January 20, 2017, 08:27:53 am »
More goodies  :D

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #672 on: February 08, 2017, 03:54:49 am »
Progress in spacedock...

Offline vonfrank

  • Lt. Junior Grade
  • *
  • Posts: 29
Re: Hex Editing of Starfleet executables
« Reply #673 on: February 08, 2017, 08:23:33 am »
I know I'm slightly changing the recent topic, but now that Hex Editing has become a popular thing in the SFC community in recent years, has anyone figured out a way to increase the 6 ship limit for SFC3 skirmishes? I realize 6 teams is very difficult to extend, but more than 6 players (5 AI ships) should be easily possible for the game to handle, especially since the skirmish list looks like it can fit a whole lot more.

This has always been one of the game's biggest limitations IMO. Playing LAN skirmishes with 2 friends would be a whole lot more interesting if we could fight a fleet of opponents instead of just being limited to a 3v3.

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #674 on: February 08, 2017, 03:04:16 pm »
Adding a 7th player would require a rewrite of many UI, network, and script functions. It is a huge task for one person. A team of ten people with C++ source code could do it. A couple of guys with hex editors...barring some unforeseen brilliant hack, it'll never happen.

The UI is the easiest aspect to mod. The multiplayer scripts don't have any data for player 7. Thousands of arrays would have to be increased by one. The entries for player 6 could be copied and edited, but the API would break. The networking stuff...I have no idea. That's the hardest. I can't see the workings of the peer-to-peer stuff with a hex editor.
 
I'm surprised that anyone is hampered by the 6-player limit in SFC nowadays. If so, there are 7 people who have a reason to download IDA and try to figure it out. Maybe they can be successful.

Offline Captain Adam

  • Lt.
  • *
  • Posts: 737
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #675 on: February 08, 2017, 08:33:48 pm »
Tar,
Is it possible to redirect a phaser to another damage chart other than its own damage chart?

Another question would be separating the PhG from utilizing the Ph3 chart and redirecting it to use its own chart in another location, let's say toward the end of the exe where there would be room for a chart.

Adam
« Last Edit: February 08, 2017, 08:47:36 pm by Captain Adam »

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #676 on: February 08, 2017, 10:40:19 pm »
Tar,
Is it possible to redirect a phaser to another damage chart other than its own damage chart?

Another question would be separating the PhG from utilizing the Ph3 chart and redirecting it to use its own chart in another location, let's say toward the end of the exe where there would be room for a chart.

Adam
An alternative phaser has to have the same amount of range brackets as the original. So I can't make a Ph-1 use the Ph-3 chart. It will read outside of this chart, perhaps doing a million points of damage or negative damage.

I could easily create a duplicate damage chart of the Ph-3. I might be able to link the Ph-G to this new chart. It's been a while since I looked at the phaser functions. It would take some serious rewriting if the flow chart for phaser selection shares a common box for Ph-3 and Ph-G...

I figured out the .mvm format tonight. No need for artifex.

Here's EarlyMap.mvm


Version/Data/Offsets
data=2368 // 940h, beginning offset of map data
text=15820 // 3DCCh, end of .mvm file

1C // 28, number of hexes west to east
0F // 15, number of hexes north to south
1A4 // 420, total number of hexes

Hex 0,0 is the first 32-byte structure (Lyran's northwest corner on a typical map)
Hex 1,0 is second 32-byte structure...
Hex 27,14 is last structure.

05 00 00 00 // 5 = Economy
00 00 00 40 // 2.0f = Impedence
05 00 00 00 // 5 = Defense for empire and cartel
06 00 00 00 // 6 = Lyran Empire in control of region
05 00 00 00 // 5 =  BeastRaiders Cartel in control of region
01 00 00 00 // 1 = Blackhole1 as terrain
00 00 00 00 // 0 = No planet
00 00 00 00 // 0 = No base

etc.

You must use little-endian hexadecimals though! So ten is 0A 00 00 00, not 10 00 00 00. Impedence is a float, the rest are integers.

[Classes/Regions]
0="Neutral"
1="Federation"
2="Klingon"
3="Romulan"
4="Gorn"
5="Lyran"
6="Hydran"
7="Mirak"
8="ISC"

[Classes/CartelRegions]
0="Neutral"
1="OrionOrion"
2="OrionKorgath"
3="OrionPrime"
4="OrionTigerHeart"
5="OrionBeastRaiders"
6="OrionSyndicate"
7="OrionWyldeFire"
8="OrionCamboro"

[Classes/Terrain]
0="(none)"
1="Blackhole1"
2="Blackhole2"
3="Blackhole3"
4="Blackhole4"
5="Blackhole5"
6="Blackhole6"
7="Asteroid 1"
8="Asteroid 2"
9="Asteroid 3"
10="Asteroid 4"
11="Asteroid 5"
12="Nebula 1"
13="Nebula 2"
14="Nebula 3"
15="Shipping Lane"

[Classes/Planets]
0="(none)"
1="Homeworld 1"
2="Homeworld 2"
3="Homeworld 3"
4="Core World 1"
5="Core World 2"
6="Core World 3"
7="Colony 1"
8="Colony 2"
9="Colony 3"
10="Asteroid Base 1"
11="Asteroid Base 2"
12="Asteroid Base 3"

[Classes/Bases]
0="(none)"
1="Starbase"
2="Battle Station"
3="Base Station"
4="Weapons Platform"
5="Listening Post"
 
I made a 3x3 micromap. Intense action would occur here. Lots of drafting one would assume.
« Last Edit: February 23, 2017, 11:04:59 pm by TarMinyatur »

Offline Captain Adam

  • Lt.
  • *
  • Posts: 737
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #677 on: February 08, 2017, 11:06:44 pm »
Dude!
That's awesome. One of my dreams is to create a map but artifex was so annoying and buggy. Thank you so much for finding these variables for the map. I look forward to fiddling with this tomorrow. Awesome find!
Is there anyway to incorporate this into the exe editor or something?
Adding a base to a hex; only one for that list or can you have a base station and a listening post?


Adam
« Last Edit: February 08, 2017, 11:18:19 pm by Captain Adam »

Offline Captain Adam

  • Lt.
  • *
  • Posts: 737
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #678 on: February 08, 2017, 11:08:47 pm »
As for the phaser, I kind of figured it had to match the amount of brackets. That's fine for me, it's no biggie when you have a chance if possible let me know if it can be done, if it's too much no worries. The map find has me more excited lol

Thanks again

Adam

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 921
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #679 on: February 09, 2017, 04:05:44 am »
As for the phaser, I kind of figured it had to match the amount of brackets. That's fine for me, it's no biggie when you have a chance if possible let me know if it can be done, if it's too much no worries. The map find has me more excited lol

Thanks again

Adam

I was wrong. I swapped the PhG call for the Ph4 call. My PhG's were doing 20 damage per pulse. But they were still under the PhG range limit of 2.99k. And the damage estimator still assumes a PhG yield of course. No crash. No change in graphics or audio. PhG's don't have to use the Ph3 chart.

StarfleetOP.exe
IDA 0x4E37B3
E8 F2 04 00 00 -> E8 43 05 00 00