Please read the usage instructions at the end of this document.

Fallout New Vegas 4GB
=====================
by MonochromeWench (the.wench@wenchy.net)
v1.7-1.8 patching by Hendricks266. http://hendricks266.duke4.net/
v1.9 patching by Roy Batty

This tool is for Steam versions of Fallout New Vegas ONLY.

Do NOT complain to us, or in the forum if you are not using a Steam version
and it doesn't work! BUY THE GAME (some mods won't work with illegal
version anyways, like TTW) !!!

FNV4GB is a tool to load Fallout New Vegas with the Large Address Aware 
executable flag set so the entire 4GB Virtual Memory Address Space can be used
by the game. This is useful when using lots of mods.

This tool has been tested to be working with both x360ce and ENBSeries.
Make sure your launch parameters are correct if you have any issues.

This is a back port of Skyrim4GB that was originally based on older versions 
of FNV4GB. The functionality of this version of FNV4GB has the same 
functionality as previously released Skyrim4GB. There are difference between 
this version of FNV4GB compared to older released versions. Note the new 
command line reference. This version of FNV4GB writes its modified executable 
to <FNV4GB-Path>\exes\FalloutNV.exe which is different to the older behavior of
<fallout new vegas path>\FalloutNV.4gb

FNV4GB is licensed under the terms of the GNU Lesser General Public License 
version 2.1. Read the included lgpl-2.1.txt for the terms. Source code is 
included with the package. Original binaries compiled using Microsoft Visual 
Studio 2010.


Update History
--------------

1.9

Fixed typos with SteamAppId in command line switch and Environment Variable

Fixed Steam overlay News/Guides and Screenshot Manager by adding SteamGameId
Environment Variable.

Removed console option. Will be restored on next rewrite as command line
argument.

Removed unfinished code for passing command line args to FalloutNV.exe, using
it resulted in FalloutNVLauncher being used always

1.8

Removed "Attach Debugger?" nag.

The console is now only enabled for exes labeled "console". If you want the old
style with a progress bar use the files in the noconsole folder.

1.7

Fixed an issue with the program exiting properly. Custom WinMain start up
procedure was not exiting cleanly on some systems due to never calling
ExitProcess on termination.

Fixed out of bounds access in helper dll.

Enabled console window by default.

1.6

Back ported Skyrim4GB to work with Fallout New Vegas. There are few difference 
between 1.6 and Skyrim4GB 1.5 other than code changes needed for Fallout New
Vegas such executable name changes, registry path changes and other similar 
changes.

FNV4GB will write out a log file to ~\Documents\My Games\FalloutNV\FNV4GB.log

Skyrim4GB 1.5 

Fixed at least one case that was causing people to get Access Denied error 
messages.

Changed the default laaexe to be '.\exes\TESV.exe' instead of 'TESV.exe.4gb'.
This is so people don't have issues with other programs detecting when Skyrim 
runs.

Updated the code so it wont fail if the original exe already had the LAA flag 
set as will apparently happen in the next Skyrim patch. If the LAA flag is 
already set, the loader will NOT create a modified executable. It will directly
run the original exe without modifications while still injecting skse and extra
dlls specified with -extradll.

Added -nolaa command line options. If the original exe didn't have the LAA flag
the loader will directly load the original exe without modifications while 
still injecting other dlls. If the original exe had the LAA flag set, then a 
modified exe will be generated with the LAA flag unset and that will then be 
run by the loader.

Skyrim4GB 1.4

Generally cleaned up the code. 

Rewrote how the helper dll is injected into the child process. Moved helper dll
code out of DLLMain into its own function that gets called after the DLL has 
finished being loaded. I want to avoid the possibility of issues with the 
Windows DLL Loader Lock.

Skyrim4GB now accepts a variety of command line parameters to control what it 
does. See the Command Line Reference below for details.

Skyrim4GB 1.3

The loader now prints out details of what it is doing.

It also now attempts to check if TESV.exe has been modified. If the exe is 
detected as modified it will tell you, instructing you to get Steam to validate
the cache.

The loader will no longer wait for TESV.exe.4gb to exit before it exits itself.

The helper dll will now attempt to hook GetModuleFileNameA, if possible, to 
disguise what exe is actually loaded. If that hook fails it will fallback to
the older CreateFileA hook.

Skyrim4GB 1.2

Skyrim4GB will attempt to load the SKSE loader (skse_steam_loader.dll).

Skyrim4GB no longer hooks GetTickCount(). 

Skyrim4GB 1.1

Made some code changes that 'may' improve things for some people. Now checks 
the Bethesda Softworks\Skyrim and Valve\Steam paths for the installation 
directory.

Also will now write out a log file to ~\Documents\My Games\Skyrim\Skyrim4GB.log
that outputs some debugging information that may help track down why it doesn't
work for some people.

If you are getting Steam Application load error 3:0000065432 messages then 
please post the log contents to the discussion thread so I can see whats going
on.

Also compiled the new version with Visual Studio 2010. This may or may not make
any difference.

Fallout4GB 1.2


Running
-------
First, make sure Steam is running. Then run FNV4GB.exe to launch the game! 
You don't even need it in the games directory, just make sure FNV4gb.exe and
fnv4gb_helper.dll are together.

I suggest you move it to the installation directory for Fallout New Vegas
anyways as it makes using multiple dll's (skse, ENB, x360ce, etc) easier.

If your version of Fallout New Vegas is not the standard version with the
SteamAppID of 22380 you need to run fnv4gb.exe and specify the actual 
SteamAppID on the command line. Example: fnv4gb.exe -SteamAppID 22380


Command Line Reference
----------------------

FNV4GB.exe    [-exe string] [-laaexe string] [-SteamAppID number] [-nolaa]
              [-noskse] [-extradll string [-extradll string [...]]]
			  [-- game parameters]


Details

-exe        The games original executable. If not an absolute path FNV4GB
            will look for the executable in the Fallout New Vegas directory 
			using paths that should be in the registry. 
			Default is FalloutNV.exe.

-laaexe     The executable created by the loader that has the LAA flag set. 
            This must not be the same file as the original executable. 
			* If this is an absolute path the file will be created using that 
			  exact path.
			* If the path starts with .\ the exe will be created relative to 
			  the directory containg FNV4GB.
			* Otherwise it will be created relative to the original executable.
			Default is use the original's name and create it in a directory 
			called 'exes' in the directory containing FNV4GB.exe.

-SteamAppId The SteamAppId id to use. Default is 22380 for Fallout New Vegas
            and 72850 for Skyrim

-nolaa      Don't set the LAA flag or unset it if it was already set in the 
            original executable

-nonvse     Disable attempting to load NVSE (New Vegas Script Extender) when
            playing Fallout New Vegas

-noskse     Disable attempting to load SKSE (Skyrim Script Extender) when
            playing Skyrim

-extradll   An extra dll to load into the laaexe process after its been 
            created. This can be specified multiple times to load more than one dll.

Command Promt Examples
----------------------

FNV4GB.exe -laaexe .\FalloutNV.exe

Create a LAA Exe called FalloutNV.exe in the directory containing FNV4GB. 

This is probably what you'd want to do if you need some other application
to detect FalloutNV.exe loading, not FalloutNV.exe.4gb

FNV4GB.exe -exe FalloutNV.exe -laaexe .\exes\FalloutNV.exe -SteamAppId 22380 -extradll xinput1_3.dll -extradll d3d9.dll

Use the FalloutNV.exe and create an LAA enabled EXE in the subfolder exes of the directory containing FNV4GB
and execute it with the SteamAppId 22380 and inject the additional dll's xinput1_3.dll and enbseries.dll

This is what you would want to do if you want the files created in the original installation folder for
Fallout New Vegas and you have copied FNV4GB and the helper dll there. Additionally setting the steamid to allow the
steam overlay to work correctly with community and screenshot features, and additionally using x360ce for 
joystick support and additionally using an enb injector series dll. (That's a mouth full!)

You can either put these into a batch file, or append the commands into a shortcut.

Shortcut command line Example
-----------------------------

In the Target box

"C:\Program Files (x86)\Steam\steamapps\common\Fallout New Vegas\fnv4gb.exe" -SteamAppId 22380 

Would set the SteamAppId to 22380 to allow steam overlay community functions to work properly.


exes folder
-----------

If you insist on using the wrapper version of ENB, you can copy the d3d9.dll to the exes directory where the patched FalloutNV.exe
is placed.

You can probably place xinput1_3.dll there for x360ce too.
