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

0 Members and 2 Guests are viewing this topic.

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #340 on: February 22, 2015, 11:23:27 pm »
Any idea what this chart is?

0, 0, 0, 0, 1, 1, 1, 1, 1, 1
0, 0, 1, 1, 1, 1, 1, 2, 2, 2
0, 1, 1, 1, 2, 2, 2, 2, 3, 3
0, 1, 1, 2, 2, 2, 3, 3, 4, 4
1, 1, 2, 2, 3, 3, 4, 4, 5, 5
1, 1, 2, 2, 3, 4, 4, 5, 5, 6

Is it for boarding party combat?

Yes. Did you want it explained?

I found this chart in the code today. It has no obvious connections to anything.

From long ago, I seem to remember that the invader rolls on the chart for every group of 10 marines and a fraction thereof. The defender can take casualties and/or abandon control spaces. I forget how the attacker suffers losses.

Tested some modifications to the chart. Capture can be prohibited in all missions. Some missions crash when a ship is recaptured. Sometimes a player will lose control of his ship and involuntarily disengage after an AI ship is captured.

Offline Corbomite

  • Commander
  • *
  • Posts: 2939
Re: Hex Editing of Starfleet executables
« Reply #341 on: February 22, 2015, 11:36:52 pm »
Each side rolls a d6 and then they look on the chart for however many BP's they have in combat and then each side subtracts the number indicated from their troops. The chart goes up to 10 BP's. If you have more than 10 BP's you are supposed to divide your forces into groups of 10 or less and roll a d6 for each group to resolve combat.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #342 on: February 25, 2015, 11:22:46 am »
Hi there,

Has been a while.
Yesterday while talking with Tar, i decided to built a tool for making hex modding more easier. I've worked during this morning on it and is pratically finished. Tar supplied me with the all the Hex he has on the moment
During the day, after checking if it is working like it should, i will release it.

Carlos
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #343 on: February 25, 2015, 11:38:26 am »
No, it will work with any version.
You just need to have a text file with the correct hex's offsets and types.
The editor will pick those values on the text file and build a graphical interface for you to edit it.

heres a picture of it:

"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #344 on: February 25, 2015, 01:47:35 pm »
Here it is.
Use it at your own risk.

http://1drv.ms/1zE7Dvr

Without any arguments, the editor will try to open "Starfleet2CE.exe", but if you add an argument like in the examples below the editor will try to open and use it instead. Of course, all the addresses in the file "offsets.txt" must have be valid!

    "SFC2CE_Editor x64.exe" my.exe
    "SFC2CE_Editor x64.exe" "my new.exe"

(The "offsets.txt" file was created and is maintained by Tar Minyatur.)

Carlos Santos
« Last Edit: February 26, 2015, 07:58:18 am by d4v1ks »
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #345 on: February 25, 2015, 02:27:10 pm »
Muchas Gracias, Carlos!

Here's an update of the offsets for the upcoming 2.673. It fixes a few of my mistakes.

It works with SFC 2.671, but the following variables are unsupported: PPD hold costs, OL PPD maximum range, Mine activation range, EM cost, T-bomb range, Hit&Run range, and the additive Cloak range adjustment.

It works very well with 2.672, except for the OL Plasma-S charge rate.

Please post any bugs that you find. I can probably fix the data.

Edit: I converted the hexadecimal numbers in the commentary to plain old numbers in offsets.txt. It should make more sense now. I've arranged the entries to alphabetical order more or less.
« Last Edit: February 26, 2015, 10:02:47 am by TarMinyatur »

Offline TAnimaL

  • Lt.
  • *
  • Posts: 772
  • Gender: Male
    • Combat Logs from the Cold Depths of Space
Re: Hex Editing of Starfleet executables
« Reply #346 on: February 26, 2015, 09:45:30 am »
Wow, I am just utterly blown away by this thread. Amazing work!

I had to take the last 9 months off from Dynaverse forums because of starting a new job and had just started dipping my toes back in, and when i first saw this thread I put off reading it until I had time. Holy. Frak. I am still working my way from the beginning so I can follow along (hexadecimal + little endian = very slow for me to comprehend) but I can't hold back any longer.


WWAAAHHHHHOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!

Krist on a kracker, this is some of the most exciting stuff I've seen for this game since the first time I learned how to mod the SFC spec file. I've been wanting to understand more of this process before throwing in my pov, adn with d4v1ks' tool I feel like I can catch up a little faster. I just wanted to share my jubilation that refelcts on what Capt Adam and Tar have posted, the child-like glee of the most  awesome present from Santa ever.

No, seriously, remember when Calvin was asking Santa for a RPG launcher for Xmas and was always disappointed when he did get it???

Mmwwhhaahaaahaaaa!

Offline TAnimaL

  • Lt.
  • *
  • Posts: 772
  • Gender: Male
    • Combat Logs from the Cold Depths of Space
Re: Hex Editing of Starfleet executables
« Reply #347 on: February 26, 2015, 09:54:24 am »
Seriously, I want to buy you all a drink. Thanks for all the hard work everyone, and keeping this game alive and vital.

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #348 on: February 26, 2015, 09:54:48 am »
Here's an update of offsets for 2.673.

I've rearranged the data into a more logical order. It is a big improvement.

This file will work with 2.672, except for the OL Plasma-S charge rate. (I moved that data because it inhabited the least significant 4 bytes of INT MAX.)

2.673 will be released this week, featuring three new hotkeys and some other stuff. I may include an Orion Engine Doubling hotkey. I don't know how to restrict it Orions. Ideally, I'd put a "2" in the variant column of shiplist.txt to permit doubling.

Edit: Download this again. The old one had a couple mistakes that have been fixed. This should show the bugfix on line 1.
« Last Edit: February 27, 2015, 03:15:15 pm by TarMinyatur »

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #349 on: February 26, 2015, 08:53:17 pm »
Hello all,

I've released a small update for the Editor.
Has some improvements.
Now it check the offset's range, size of data, values, and memory overlapping.
I think it is a little faster too.
Etc...
Use at you own risk.

http://1drv.ms/1zE7Dvr

This update has no offsets.txt
Look for it somewhere under this topic.  ::)


Carlos
« Last Edit: February 27, 2015, 06:57:55 am by d4v1ks »
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #350 on: February 26, 2015, 09:39:23 pm »
Seriously, I want to buy you all a drink. Thanks for all the hard work everyone, and keeping this game alive and vital.
You are welcome, TAnimaL. If we meet on Romulus someday, you can buy a round of ale for the crew.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #351 on: February 28, 2015, 06:35:44 pm »
Today, i found 1 or 2 minor issues in the editor parser, that could make the editor crash while trying to read the «offsets.txt» file.
But already fixed it.
Meanwhile, to allow a more user friendly interface i relaxed a bit the accepted format, and added some new types.
Tomorow will release it.
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline TAnimaL

  • Lt.
  • *
  • Posts: 772
  • Gender: Male
    • Combat Logs from the Cold Depths of Space
Re: Hex Editing of Starfleet executables
« Reply #352 on: February 28, 2015, 07:50:06 pm »
I haven't had time to do more than dload but now, come to think of it, just how does one "add an argument" as you mention a few posts back? "cause I didn't follow your example. Not that it matters until someone releases offsets for OP, III, etc. (pretty please) I'm way behind the curve on everyone else here and won't have time til tazes are done ::)

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #353 on: February 28, 2015, 08:47:17 pm »
TAnimaL, you could create a batch file and put it in your SFC:OP root folder.

For example, you can use notepad to write this:
Code: [Select]
"SFC_Editor x86.exe" StarfleetOP.exe
pause
Save this plain text file as OP_Edit.bat

When you open OP_Edit.bat it will load StarfleetOP.exe, the custom argument, instead of Starfleet2CE.exe. Of course, as you noted, it needs the correct offsets.txt too.

Offline JanB

  • Lt. Junior Grade
  • *
  • Posts: 103
Re: Hex Editing of Starfleet executables
« Reply #354 on: March 01, 2015, 11:03:16 am »
I found out a bit more about hardcoded weapon colors. Some weapons derive all their color from their textures (example the photon torpedo). In SFC3 the phasers and some other weapons and effects are colored by a set of RGB values, some of these are listed in sub_41C726. Basically you'll see (in pseudocode mode) stuf like "sub_41CFAA((int)&v22, COERCE_INT(0.93000001), COERCE_INT(0.75999999), COERCE_INT(0.1));" (the numbers are rounded 32bit floats, for example 0.1 is coded as CD CC CC 3D at 00(4)1C8E2). So what color does this result in? Let's see: 0.93000001 * 256, 0.75999999 * 256, 0.1 * 256 gives us approximately Red: 238, Green: 195, Blue: 26, this is a shade of dark orange, exactly like we expect of SFC3 phasers.

For SFC:OP the equivalent of sub_41C726 is sub_41C271. In it I found (in pseudocode mode) "sub_41C983(LODWORD(v29), LODWORD(v33), LODWORD(v34));" with the values of the variables listed next to it: "v34 = 1.0; v33 = 0.5; v29=v27 = 0.5;", so this would be Red: 128, Green: 128, Blue: 256 which is a shade of light blue. I have no working copy of SFC:OP test if this codes weapon colors (it seems to be connected to the function chain of the "heavy phaser" object), but I'm pretty sure it does.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #355 on: March 01, 2015, 02:25:05 pm »
Ok, the next version of the SFC Editor is available.
I am happy with its current state.
Unless someone finds something wrong with it, is likely to be the final version.

Now you can use it too with other offset files.
I left examples inside the .zip for you to know how to use the SFC Editor.

Have fun!  8)

http://1drv.ms/1zE7Dvr
« Last Edit: March 01, 2015, 04:38:27 pm by d4v1ks »
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #356 on: March 01, 2015, 02:50:22 pm »
Thanks again, Carlos.

I like how the floating-point numbers are in purple and the integers are in black.

Good work.

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #357 on: March 01, 2015, 04:48:32 pm »
I like how the floating-point numbers are in purple and the integers are in black.

Have you tried to change this offset, to see how it looks now?

65FA28: 7c // SFC2CE version // 2.6.7.3
"But he isn't wearing anything at all!" (The Emperor's New Clothes)

Offline TarMinyatur

  • Lt.
  • *
  • Posts: 938
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #358 on: March 01, 2015, 06:52:59 pm »
Very nice. Red font for ascii characters and blue font for unsigned bytes. Those will be helpful, indeed.

Possible problem with new line. The unsigned bytes are not saved by the editor.

6902D: ub // Capture Enabled = 134 (0x86), Capture Disabled = 135 (0x87) // 134 (0x86)

The Editor writes a null byte to the memory address, not an 86 or 87.

Ideally, the 86 or 87 should always be represented as an 86 or 87. I changed an Intel opcode there, not a countable variable. Converting 0x86 to an unsigned byte 134 or to a signed byte -122 is just asking for trouble.

The following offset entry is what I'd like to see:

6902D: 1umb // Capture enabled = 86, Capture disabled = 87 // 86

The editor would display it as an unmodified byte.
« Last Edit: March 02, 2015, 02:48:21 am by TarMinyatur »

Offline d4v1ks

  • D.Net VIP
  • Lt.
  • *
  • Posts: 788
  • Gender: Male
Re: Hex Editing of Starfleet executables
« Reply #359 on: March 02, 2015, 03:07:16 am »
Possible problem with new line. The unsigned bytes are not saved by the editor.
(...)
The Editor writes a null byte to the memory address, not an 86 or 87.

Yes, you are right.
Thank you for bringing that to my attention.
In fact the value was not being updated before saving to the executable.
I uploaded a new version (1.2.1) with the fix.
As i touched in that code again i also added big-endian support. So now the Editor should work with both processor architectures (little and big endian).

About, that new feature, i will add it soon.
"But he isn't wearing anything at all!" (The Emperor's New Clothes)