distrohelena / nucleuscoop

Starts multiple instances of a game for split-screen multiplayer gaming!
https://www.reddit.com/r/nucleuscoop/comments/clkqp9/all_new_nucleuscoop_supported_games/
MIT License
811 stars 197 forks source link

Issue with different resolution monitors #48

Open nolekev1214 opened 8 years ago

nolekev1214 commented 8 years ago

When setting two players to monitors of different resolutions. The resolution of the primary monitor is used causing the secondary screen to have a cut off image. Game = Borderlands 2

aetha commented 8 years ago

So I looked into this and it's a pretty silly bug. I think Nucleus writes ResX & ResY to WillowEngine.ini as it launches each instance but this isn't reliable & they all get the first instance's res. Easy fix: put ResX & ResY in the command arguments instead. I'm too lazy to make a commit. ¯(ツ)/¯

In Borderlands2.js, comment out these lines

        //new Nucleus.IniSaveInfo("SystemSettings", "ResX", Context.Width),
        //new Nucleus.IniSaveInfo("SystemSettings", "ResY", Context.Height),

I cleaned up the arguments line & added res:

    Context.StartArguments = "-windowed ResX=" + Context.Width + " ResY=" + Context.Height + " -AlwaysFocus -nostartupmovies -SaveDataId=" + Context.Options["saveid" + Context.PlayerId];

    if (Context.IsKeyboardPlayer)
        Context.StartArguments += " -NoController";
ninetaled commented 7 years ago

I did what you said and put the context.set... after the controller if statement and nothing changed. Any Idea?

vaalgaav commented 7 years ago

I don't quite understand the instructions.

I edited the first two lines, nothing changed. Then I copied the lines you posted below, and still the same.

cade111 commented 7 years ago

could somone please elaborate on what she ment by

I cleaned up the arguments line & added res:

Context.StartArguments = "-windowed ResX=" + Context.Width + " ResY=" + Context.Height + " -AlwaysFocus -nostartupmovies -SaveDataId=" + Context.Options["saveid" + Context.PlayerId];

if (Context.IsKeyboardPlayer)
    Context.StartArguments += " -NoController";
shmann commented 7 years ago

What was implied but perhaps unclear to some is that she meant for us to comment out the arguments lines and use the "cleaned up" lines provided:

//    if (Context.IsKeyboardPlayer) {
//        Handler.StartPlayTick(1, function () {
//            Handler.CenterCursor();
//        });
//        Context.StartArguments = "-windowed -AlwaysFocus -NoController -nostartupmovies -SaveDataId=" + Context.Options[playerStr];
//    }
//    else {
//        Context.StartArguments = "-windowed -AlwaysFocus -nostartupmovies -SaveDataId=" + Context.Options[playerStr];
//    }

Context.StartArguments = "-windowed ResX=" + Context.Width + " ResY=" + Context.Height + " -AlwaysFocus -nostartupmovies -SaveDataId=" + Context.Options["saveid" + Context.PlayerId];

if (Context.IsKeyboardPlayer)
    Context.StartArguments += " -NoController";

EDIT: It worked great for me, thanks Aetha! EDIT 2: Just kidding, the code didn't keep the save files for me. I ended up just pasting the relevant part in like this:

    if (Context.IsKeyboardPlayer) {
        Handler.StartPlayTick(1, function () {
            Handler.CenterCursor();
        });
        Context.StartArguments = "-windowed ResX=" + Context.Width + " ResY=" + Context.Height + " -windowed -AlwaysFocus -NoController -nostartupmovies -SaveDataId=" + Context.Options[playerStr];
    }
    else {
        Context.StartArguments = "-windowed ResX=" + Context.Width + " ResY=" + Context.Height + " -windowed -AlwaysFocus -nostartupmovies -SaveDataId=" + Context.Options[playerStr];
    }