I'm trying to fix an issue with a compiled executable that the original developers have long given up support for. Essentially, the executable is using the wrong graphics card, it uses an integrated graphics card over the dedicated one.
I know I can go into my Graphics Settings on Windows or even through the Graphics Card control panel to select what graphics card the game uses, but I was curious if I could also do it programmatically at an assembly level.
I found this article that explains how you can do it programmatically, but now I'm wondering how I could do this using assembly.
Forcing Machine to Use Dedicated Graphics Card?
It looks like I only need to add this bit of code to the executables assembly. Is this possible, or does it have to be done in C++ before the EXE is compiled...? Or perhaps using a PE editor that is able to edit the export table (if that's a thing)...
extern "C"
{
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
}
extern "C"
{
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}