- Go to Releases and download
d3d9.dll - Place
d3d9.dllinto the main game directory whereBH6.exeis located (steamapps\common\Resident Evil 6) - Start the game normally
The mod will automatically set the game resolution to the resolution of the screen the game is launched on.
There will be NO OTHER RESOLUTIONS available in the game's graphic settings.
To change the resolution, follow these steps:
- Navigate to the main game folder where
BH6.exeis located (steamapps\common\Resident Evil 6) - Open the
resourcefolder - If you already started the game at least once with this mod, there will be a file named
re6cfg.json, if not, create it or run the game once (with this mod in the game dir) - Open the
re6cfg.jsonfile, and change thedisplayWidthanddisplayHeightto a desired resolution that your screen supports. If you created the file manually, use the config template below. - Save the file and run the game
{
"displayWidth": 1920,
"displayHeight": 1080
}
The game assumes that the screen it's currently running on will have less than 256 modes (apparently this is a trend, Mad Max does the same).
Having less than 256 display modes is very common with older hardware, but modern monitors usually have way more than 256 modes.
This would not be a problem, if the game implemented proper bounds checking, which is unfortunately not the case.
The structure which is to be populated with modes obtained via IDirect3D9::EnumAdapterModes is only big enough to hold 256 modes.
However, the game will happily loop through and process all available modes from 0 up to the number of available modes obtained via IDirect3D9::GetAdapterModeCount.
This can be seen in this rough pseudocode reconstruction:
DWORD32 totalModeCount = IDirect3D9::GetAdapterModeCount(
currentAdapterIdx,
D3DFMT_X8R8G8B8
);
DWORD32 modeEnumIndex = 0;
do {
// ...
HRESULT hr = pD3D9->EnumAdapterModes(
edi,
D3DFMT_X8R8G8B8,
modeEnumIndex,
&mode
);
// ...
++modeEnumIndex;
} while ( modeEnumIndex < totalModeCount);This could be fixed either by patching this instruction:
.text:00F42939 3B 44 24 30 cmp eax, [esp+0C0h+totalModeCount]With a force clamp like:
cmp eax, 0x100
jb _continueHowever, this approach would limit the potentially desired display modes from appearing in the game settings.
Instead of clamping the loop to for (mode = 0; mode < 256; mode++);, this tool/mod/patch/fix obtains a desired resolution from a config file (or currently used screen res if no cfg file), and filters through all available modes in order to cherry-pick only the ones matching the desired resolution.
This way, the game settings will still contain available refresh rate options for the selected resolution.
However, if the target screen somehow still has more than 256 available modes for the specific given resolution, the modes will be clamped. (i.e. if you're playing this on a 5000000Hz monitor in the year 2369, I have bad news for you).
Hooked VTable functions:
IDirect3D9::EnumAdapterModesIDirect3D9::GetAdapterModeCount
Hooked native function:
Direct3DCreate9