F4Patch Plugins and EXE edits
Falcon 4.0 is a successor of a series of the best flight sims "Falcon"
(F-16 simulation) ever available on market. Falcon 4.0 was developed by
Hasbro, but later terminated due to financial reasons. A group of flight
sims enthusiasts formed of ex and active military personell (mechanics
and pilots on various types of military aircraft including F-16s, F-117,
B-1, A-4, F-4, F-15C, tank commanders, Patriot ADS officers, SA-3 officers)
from all around the world, combined with civilian pilots and a handfull
of programmers (including myself) then decided to take over a free-of-charge
developement of this sim and prolonged its lifetime for three years past
the project termination date.
As said, after the project 1.08 release Hasbro terminated it, but a
testing group iBeta took over and released
two more compiled versions of Falcon (Falcon4_108i and Falcon4_108i2)
with some bugs removed. Falcon4_108i2 was the most stabile released version
of this game.
After iBeta dropped it, this group I mentioned above the Realism
Patch Group, took it over.
First developement goal of RPG were data edits. These were hex edits
of large data files where weapon and vehicle characteristics were stored.
By altering these values to match the reality conditions Falcon4 was made
far more realistic that it originally was. But some changes could not be
made without EXE edits.
I was the fourth and the last programmer that joined RPG (after Poogen,
Sylvain Gagnon and Marco Formato).
Since we did not have the code of the Falcon4_108i2 release, we had
to hex edit the machine code in the existing exe instead of building a
new release version from CPP code.
To do that, a programmer Joel Bierling
developed a program that read text files where offsets and old plus new
hex data was written. Instead of supplying the general public completely
new versions of hacked files, we only had to write changes into text files
and then this program F4Patch did the job on local machine.
But not everything could be done just by hex editing data files and
exe file. Therefore Joel expanded his progra to be able to run external
plugins which could do much more than just hex edits.
For example, new weapons were introduced into the game, like AGM-142,
J-7III, Su-30MKK etc..., and all these additions demanded to not just change
data structures but also add new 3D graphics (new missile, new aircraft
models) to the game.
Plugins I made:
-
F4P_LODAppender
This is a plugin that takes one small 3D graphics file and attaches it
to the large 25 MB bank of 3D models used inside Falcon4. Since additions
are not mandatory but user choice, newly-added models have their index
numbers not specified, but are floating on the end of this large file instead.
So when user removes one of the added 3D models, all following models are
shifted back in the file (thus keeping the file at the minnimum possible
file length) and all references to these model indexes in other files are
reindexed. When model is added it allways goes to the end of the file.
This plugin was the most widely used one, since more than 100 new models
were added to the game till August 2001, today number is much bigger.
-
F4P_TEXAdd is another plugin used for graphics. New 3D models required
also new textures to be added. This plugin adds new textures (LZZS compressied
BMPs) to the large textures bank file at predetermined (fixed) texture
indexes.
-
F4P_RawAdd is a plugin that made possible not just to change certain
data records in data files (when new weapons and vehicles were created,
some older vehicles were sacrificed) but to add completely new data records
of ANY length, at predetermined index, to ANY file.
-
F4P_ParentMod is a plugin that modifies or adds new parent records.
These are records that manage 3D models and their level of detail bubble
ranges.
-
F4P_Voice is a plugin for adding new voices to the game. When new theatres
emerged, new ATO voices for newly added airbases needed to be recorded
and added to the game. F4P_Voice plugin later took over another programmer,
Manfred Nelles.
-
One very imporant plugin is also F4P_Backup. There are 20.000 users
of RPG Falcon4 modifications around the world. Some of these users screw
up their installations sometimes and then complain some awkward behaviors.
Therefore we suggested them to first backup their clean Falcon4 1.08 installation
and then proceed with patching process, so if anything goes wrong and installation
is permanently damaged, instead of reinstalling it, they could just replace
it with a fresh backup copy. To automatize this process I created this
backup plugin that automatically backs up all files that are changed, and
then when called replaces corrupt ones with new ones.
Plugins code available here.
Plugins release version and instructions available here.
Here`s the work I did in the exe:
-
ADS Cockpits is a large group of interconnecting hacks. ADS stands
for Aircraft Dependent Switchers. With access to fly all aircraft in the
game instead of only F-16s, various things were plain wrong. For instance,
by entering MiG-29 you still had F-16s cockpit, you could still see F-16s
exterior (wings and fuselage), you had F-16s HUD and western type RWR,
you could still hear sounds that were F-16-owned, you could still use all
the MFD and Radar functions from F-16, and finaly you had Field Of Vision
that of F-16. This had to be changed. All of these things I named here
are hardcoded inside the exe like constant values or name strings or as
code so, changing them requested me to cheat the program.
With ADS Cockpits installed, by switching to different aircraft, everything
is also switched automatically.
-
2D Cockpit switcher is a part that overruns certain memory locations
in runtime and forces changes on namestrings that determine which GIF files
will be opened as 2D cockpit representation.
-
3D cockpit switcher when activated by switching to a different aircraft,
overruns some memory locations that hold index pointer to 3D model used
for aircraft exterior (wings, 3D cockpit, fuselage).
-
Activate moving surfaces is a patch that activates external aircraft
surfaces so they are movable. From now on you can see (this was a bug)
out the window slats and flaps moving, airbrake extending, elevators moving,
jet plume, wings swingin in swing-wing aircrafts ...
-
Keymap Switcher forces Falcon to load an arbitrary keymap file thus
forcing the user to use a specific keymaps. With this we can block certain
systems that are not resent in some aircraft from being accessed through
keyboard.
-
NVG Switcher deals with Pilot Night VIsion Capabilities. Night Vision
Goggles. SOme western aircraft like F-16s have NVG capability standardly
used, other aircraft don`t. So if you fly MiG-21 at night you cannot use
NVG and it gets blocked
-
Sound switcher forces.sounds to no longer be hardcoded but externally
defined. With this, new cockpit sounds can be added to the sim.
-
Display switcher. This is the parade horse of mine. All display
representations are hardcoded in Falcon4. HUD is a bunch of code, RWR is
a bunch of code, MFDs is a bunch of code. So when flying MiG-29 you don`t
have F-16 HUD, but ought to have a MiG-29 HUD. Also you don`t get western
type RWR display but a SPO-15 Beryoza threat indicators. Similary is with
MFDs. You no longer have all the FCR, SMS, HSD, HTS etc MFD modes, but
only radar mode.
To change this I had to search the exe for pointers that determine class
member functions that draw these things to screen. I rerouted these pointers
to point to my code which then or allocates new memory and loads
an external code fragment into it and then runs it (consider it like DLL
but much simpler) or if external code frag is missing it jumps to original
code.
By doing this I opened myself a way to create a huge number of code fragment
files which contained new display procedures for HUD (MiG-29 hud, F-4,
F-5, MiG-21 gunsights) new pages for MFDs (instead of B-scope synthetic
radar displays I created A-scope unfiltered radar displays for aircraft
like F-5, MiG-19 and MiG-21 by instructions of a very educated F-16 systems
engineer who revealed me all drawbacks of older radar systems, inparticualr
that present on F-5E) and also RWR (now Soviet aircraft no longer had to
use western type of threat representation but I developed SPO-15 indicator).
-
Pilot Head is a hack that unlocks the viewpoint coordinated in 3D
cockpit, thus making your "head" a floating ball like in reality. This
patch calculates angular accelerations and by using this data it tilts
your head sideways when rolling the aircraft violently.
-
Afterburner hack unlocks the afterburners. This was a major bug
in Falcon4, since all the aircraft used the same engine routine. When AI
tilted the thrust leaver to the max or colse to the max (RPM over 97%),
afterburners automatically kicked in. The result was thrust like afterburners
were not present (like on B-52) but fuel flow was 3.6 times greater that
it should be (it calculated fuel flow like AB is ON). This had to be corrected
since aircraft were running out of fuel to quickly and you could hear the
afterburner sound in A-10 when spinning RPM to 100% although it wasn`t
there.
-
Depression is an hack that displays CCIP bombing mode piper depression
angle in MILS (miliradians depression angle). It is not meant for general
public but rather for testers of aircraft. By dive-bombing using CCIP and
reading AGL altitude, KIAS velocity and MILS depression you can generate
bomb depression tables that can be used on older types of aircraft that
had a gunsight instead of HUD.
-
Long_Lat_Date is a hack that unlocks theatre map-center world coordinates
and campaign date. Since in Falcon4 these values are hardcoded as constants
this had to be changed to fully implement new theatres.
Assembly code for exe hacks available here.
Snapshots available here.
Miran Klemenc, April 15th
2002