RETROBAT Official Board
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[RESOLVED] Focus window issue on boot up

+5
Aynshe
Lorenzolamas
docam30
FiveOver014
agentsmith6403
9 posters

Go down

[RESOLVED] Focus window issue on boot up Empty [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 14/02/24, 08:55 pm

Hello everyone. Just set up latest retrobat on windows 11. It boots up on startup no problem but the window is not in focus so unable to use controllers without clicking mouse first. Anyway around this so can use controllers only?
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 14/02/24, 10:17 pm

Had a similar problem.

This helped to resolve the issue for the main window focus after booting into Retrobat.

1. Enable video intro in the settings.

For some reason if Intro Video is disabled, the window for Retrobat will not be the main focus.

In addition, you can set a very short time for displaying the intro video if you rather not wait for the entire video.
FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

mattwu64 and docam30 like this post

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 14/02/24, 11:28 pm

FiveOver014 wrote:Had a similar problem.

This helped to resolve the issue for the main window focus after booting into Retrobat.

1. Enable video intro in the settings.

For some reason if Intro Video is disabled, the window for Retrobat will not be the main focus.

In addition, you can set a very short time for displaying the intro video if you rather not wait for the entire video.

I'll give that a go thanks.
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 15/02/24, 08:09 pm

FiveOver014 wrote:Had a similar problem.

This helped to resolve the issue for the main window focus after booting into Retrobat.

1. Enable video intro in the settings.

For some reason if Intro Video is disabled, the window for Retrobat will not be the main focus.

In addition, you can set a very short time for displaying the intro video if you rather not wait for the entire video.

That didn't work. For some reason it's not playing the startup video it just fails to boot instead.
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 15/02/24, 08:53 pm

When you say it fails to boot, do you mean when you have show intro video enabled, that Retrobat fails to load or just the video fails to load and play?

The next question, are you using the latest stable version Retrobat V6? or are you still on Retrobat v5.3?

In addition, did you get the copy that is currently installed directly from Retrobat or was it through a third party?
FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 15/02/24, 10:16 pm

FiveOver014 wrote:When you say it fails to boot, do you mean when you have show intro video enabled, that Retrobat fails to load or just the video fails to load and play?

The next question, are you using the latest stable version Retrobat V6? or are you still on Retrobat v5.3?

In addition, did you get the copy that is currently installed directly from Retrobat or was it through a third party?

It fails to boot entirely. I'm now having an issue when got windows retrobat starts up but then disappears.

I'm running latest V6 stable which I got from the official site.
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 15/02/24, 11:27 pm

How did you change the intro video settings? Was the retrobat.ini file edited through notepad or a similar text editor?

You have to change the intro video settings using the BatGui.exe program.

If this was a fresh install, we can easily just delete that entire directory and do a fresh install of Retrobat again.

FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 15/02/24, 11:47 pm

FiveOver014 wrote:How did you change the intro video settings?  Was the retrobat.ini file edited through notepad or a similar text editor?

You have to change the intro video settings using the BatGui.exe program.  

If this was a fresh install, we can easily just delete that entire directory and do a fresh install of Retrobat again.


Yes edited through the gui program. I've noticed that I save the config then exit and when I go back the intro truck box is unchecked again. I have also tried through notepad changing 0 to 1. Not difference.

I haven't changed the timer for video, that has been left as default and the intro videos are as when installed. 4 different MP4 files.

Strange the intro no longer works. This was to hopefully fix an issue focusing the program so can use controller without mouse click.
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 15/02/24, 11:48 pm

Is there a safe way to reinstall without losing setup data?
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 16/02/24, 12:16 am

You can try this. rename the current folder that is having issues. Create a new same name folder as the old install. Do the install into that new directory.

Launch Retrobat and make sure everything is working.

As for the settings, if the settings config file is corrupted, I would just go with doing a fresh install and copying over all the ROMs, BIOs, SAVES and Themes into the new directory.

If you have made changes to any of the themes configurations, you can grab those from this directory

RetroBat\emulationstation\.emulationstation\themesettings

Any files in that directory just copy and paste into the same directory under the new install.
FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by agentsmith6403 17/02/24, 11:53 am

Hi again. After reinstalling retrobat the intro video now works and the video is in focus. Thanks for your help with this.
agentsmith6403
agentsmith6403

Messages : 27
Date d'inscription : 2024-02-14

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 17/02/24, 08:39 pm

Glad you where able to get Retrobat up and running. Happy Retro Gaming!
FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

getupor likes this post

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by docam30 25/02/24, 02:33 pm

FiveOver014 wrote:Had a similar problem.

This helped to resolve the issue for the main window focus after booting into Retrobat.

1. Enable video intro in the settings.

For some reason if Intro Video is disabled, the window for Retrobat will not be the main focus.

In addition, you can set a very short time for displaying the intro video if you rather not wait for the entire video.

Thank you very much for this tip.

Also no more video in folder (I've deleted them), then in retrobat.ini, I've set VideoDuration=3000 and FileName="", now have a black screen during 3 seconds when I run RetroBat (it's normal) from Desktop shortcut, and RetroBat application have the focus, bingo!

IMPORTANT: set the retrobat.ini as Read Only, otherwise the settings are destroyed as soon as you'll launch RetroBat!

Using RetroBat v6.0.0 stable (lastest in date).
docam30
docam30

Messages : 14
Date d'inscription : 2024-02-25

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Lorenzolamas 25/02/24, 06:20 pm

IMPORTANT: set the retrobat.ini as Read Only, otherwise the settings are destroyed as soon as you'll launch RetroBat!


Nope, don't do that....

Next time, please, when you think you've found a bug, tell us rather than giving bad advice.
Lorenzolamas
Lorenzolamas
Admin

Messages : 2641
Date d'inscription : 2019-07-28

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by docam30 26/02/24, 11:49 am

Lorenzolamas wrote:
IMPORTANT: set the retrobat.ini as Read Only, otherwise the settings are destroyed as soon as you'll launch RetroBat!


Nope, don't do that....

Next time, please, when you think you've found a bug, tell us rather than giving bad advice.

I've two questions for you:
- Can you tell why the retrobat.ini is always reset to initial settings everytime I run RetroBat?
- Why the focus issues when launching RetroBat? (I must do a left-mouse click over it prior to use my gamepad).

Other thing: except when I set (check) Full screen and Force Full Screen, RetroBat crashes very often, including during game browsing, or from menus! So, by using Read Only .ini file, at the moment, is the only way to use RetroBat without any crash.

I've quit the (defunct) HyperSpin system because it no more maintained by developer, and all videos/themes are very jerky/laggy, aka unusable (HS and Windows 10 aren't friends). By this way, I was gone - couple of weeks ago - to RetroBat v6.0.0, as frontend replacement (by following users recommendations), but be sure I'm a bit disapointed about frontend stability/reliability. Also be sure I'm using a good PC (Intel Core i9-9900KF @ 4.5GHz, 32GB DDR4-3200 RAM, RTX 2080 (8GB) GPU, SSDs, and so on, all drivers for Windows 10 are upto date), it works fine since 2021, including Windows games, Visual Pinball / PinUP System, and so on...
docam30
docam30

Messages : 14
Date d'inscription : 2024-02-25

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Aynshe 26/02/24, 12:20 pm

docam30 wrote:
Lorenzolamas wrote:
IMPORTANT: set the retrobat.ini as Read Only, otherwise the settings are destroyed as soon as you'll launch RetroBat!


Nope, don't do that....

Next time, please, when you think you've found a bug, tell us rather than giving bad advice.

I've two questions for you:
- Can you tell why the retrobat.ini is always reset to initial settings everytime I run RetroBat?
- Why the focus issues when launching RetroBat? (I must do a left-mouse click over it prior to use my gamepad).

Other thing: except when I set (check) Full screen and Force Full Screen, RetroBat crashes very often, including during game browsing, or from menus! So, by using Read Only .ini file, at the moment, is the only way to use RetroBat without any crash.

I've quit the (defunct) HyperSpin system because it no more maintained by developer, and all videos/themes are very jerky/laggy, aka unusable (HS and Windows 10 aren't friends). By this way, I was gone - couple of weeks ago - to RetroBat v6.0.0, as frontend replacement (by following users recommendations), but be sure I'm a bit disapointed about frontend stability/reliability. Also be sure I'm using a good PC (Intel Core i9-9900KF @ 4.5GHz, 32GB DDR4-3200 RAM, RTX 2080 (8GB) GPU, SSDs, and so on, all drivers for Windows 10 are upto date), it works fine since 2021, including Windows games, Visual Pinball / PinUP System, and so on...

Hi,

- Can you tell why the retrobat.ini is always reset to initial settings everytime I run RetroBat?

a bug seems to have been identified in batgui, unless I am mistaken it has been corrected. But I don't know if the update is available.

- Why the focus issues when launching RetroBat? (I must do a left-mouse click over it prior to use my gamepad).

It's a problem more visible under Windows 11.

Maybe try this : https://discord.com/channels/748519802255179917/1205863195772854373/1205924799696740442

Or start retrobat after kill explorer.exe (kill in tasklist by batch or gpedit replacing explorer.exe with retrobat.exe

But run a launch video before retrobat without also helping to reestablish focus if I don't say anything stupid.

Other thing: except when I set (check) Full screen and Force Full Screen, RetroBat crashes very often, including during game browsing, or from menus! So, by using Read Only .ini file, at the moment, is the only way to use RetroBat without any crash.

I've quit the (defunct) HyperSpin system because it no more maintained by developer, and all videos/themes are very jerky/laggy, aka unusable (HS and Windows 10 aren't friends). By this way, I was gone - couple of weeks ago - to RetroBat v6.0.0, as frontend replacement (by following users recommendations), but be sure I'm a bit disapointed about frontend stability/reliability. Also be sure I'm using a good PC (Intel Core i9-9900KF @ 4.5GHz, 32GB DDR4-3200 RAM, RTX 2080 (8GB) GPU, SSDs, and so on, all drivers for Windows 10 are upto date), it works fine since 2021, including Windows games, Visual Pinball / PinUP System, and so on...

I haven't seen a similar case, could you submit your request to support on the discord ?


[RESOLVED] Focus window issue on boot up Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 26/02/24, 12:42 pm

Have you tried to uncheck both the Force Full Screen and Full Screen to see if that helps?

I find that turning on the controller before launching retrobat helps with the window focus issue....but there are times Retrobat will not be the main focus and I have to click the Retrobat window to get the controller to work within Retrobat.

As for the
FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by docam30 26/02/24, 12:59 pm

FiveOver014 wrote:Have you tried to uncheck both the Force Full Screen and Full Screen to see if that helps?

I find that turning on the controller before launching retrobat helps with the window focus issue....but there are times Retrobat will not be the main focus and I have to click the Retrobat window to get the controller to work within Retrobat.

As for the

If I uncheck either or both, I get RetroBat crashes (very often), including on game emulation exit (mame, neogeo, I don't have other systems at the moment), sometimes from any RetroBat menus...

No crash occur while both are checked, however (never crash, in fact).

My (wired) controller is Logitech RumblePad 2, always connected (always on).
docam30
docam30

Messages : 14
Date d'inscription : 2024-02-25

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by FiveOver014 26/02/24, 01:26 pm

The crashing is troublesome... since you have altered some files for read/write permissions....

My suggestion would be to do a fresh install and copy over the following folders (bios, themes, themesettings, roms, saves) to the new installation and see if that helps...


FiveOver014
FiveOver014

Messages : 30
Date d'inscription : 2023-12-20

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by docam30 26/02/24, 01:32 pm

I precise I can't kill explorer.exe, because I'm using my "everyday regular PC" (Windows 10 Pro x64 22H2) - also used as gaming PC (have many Steam & Epic games), Visual Pinball X (& PinUP System as frontend/player), Internet, MS Office, image & video processing, watching videos, C++ & LUA developments, and Computer Music!

By this way, the kill explorer.exe option isn't acceptable for me!

I launch RetroBat via shortcut on Windows' Desktop:
- Target: C:\RetroBat\retrobat.exe
- Start from: C:\RetroBat

Also, I've added an homemade 6.25s second video as intro (duration parameter in retrobat.ini is set as 6000).


Last edited by docam30 on 26/02/24, 01:42 pm; edited 2 times in total
docam30
docam30

Messages : 14
Date d'inscription : 2024-02-25

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by docam30 26/02/24, 01:37 pm

FiveOver014 wrote:The crashing is troublesome... since you have altered some files for read/write permissions....

My suggestion would be to do a fresh install and copy over the following folders (bios, themes, themesettings, roms, saves) to the new installation and see if that helps... => Installed since 3 days, I'll must reinstall a new one? it's not serious.lol!



Crashes PRIOR to edit/set retrobat.ini (then set it as Read Only).

Since I've set a 6.2s intro video, have checked both Full screen and Force full screen, and set retrobat.ini as R/O (otherwise it will be resetted), no more crash Evil or Very Mad and no more focus issues.
docam30
docam30

Messages : 14
Date d'inscription : 2024-02-25

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Aynshe 26/02/24, 02:25 pm

docam30 wrote:I precise I can't kill explorer.exe, because I'm using my "everyday regular PC" (Windows 10 Pro x64 22H2) - also used as gaming PC (have many Steam & Epic games), Visual Pinball X (& PinUP System as frontend/player), Internet, MS Office, image & video processing, watching videos, C++ & LUA developments, and Computer Music!

By this way, the kill explorer.exe option isn't acceptable for me!

I launch RetroBat via shortcut on Windows' Desktop:
- Target: C:\RetroBat\retrobat.exe
- Start from: C:\RetroBat

Also, I've added an homemade 6.25s second video as intro (duration parameter in retrobat.ini is set as 6000).

To answer, kill explorer.exe before launching retrobat then restart it automatically afterwards is entirely possible in batch.

This is a possibility and as specified you have a link to the discord offering another potential idea to resolve the focus.

Otherwise a video when launching retrobat should also resolve the problem, also as also specified there is a fault which currently resets the .ini when launching retrobat.


[RESOLVED] Focus window issue on boot up Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by docam30 26/02/24, 03:25 pm

Aynshe wrote:Otherwise a video when launching retrobat should also resolve the problem, also as also specified there is a fault which currently resets the .ini when launching retrobat.

Yep, by using 6.2s homemade intro video (duration parameter is set to 6100ms, like VideoDuration=6100, into retrobat.ini), I don't have focus issue anymore.

A feature who permit to stop/cancel the intro video (while playing) and go to frontend... will be appreciated, IMO.
docam30
docam30

Messages : 14
Date d'inscription : 2024-02-25

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Aynshe 26/02/24, 04:06 pm

docam30 wrote:
Aynshe wrote:Otherwise a video when launching retrobat should also resolve the problem, also as also specified there is a fault which currently resets the .ini when launching retrobat.

Yep, by using 6.2s homemade intro video (duration parameter is set to 6100ms, like VideoDuration=6100, into retrobat.ini), I don't have focus issue anymore.

A feature who permit to stop/cancel the intro video (while playing) and go to frontend... will be appreciated, IMO.

A lot of uncertainty in what I am announcing because I have missed a lot of discord exchanges for a while due to lack of time and other activity, so it is possible that this is a bug.

But yes normally it should be possible to stop the intro video.

So maybe wait for another opinion on the subject.


[RESOLVED] Focus window issue on boot up Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

docam30 likes this post

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by ccrexet 03/11/24, 10:01 am

Hello,

I've developed a PowerShell script that simulates a single mouse click 60 seconds after Windows boots up. This script completely resolved my issue with RetroBat not being recognized as the top UI and ensuring proper detection of input controllers, such as the Ipac 2 in Xinput mode.

I battled this issue many times, switching controllers, adjusting startup options, and even considering returning to BigBox. After realizing that manually clicking with the mouse was the only reliable solution, I created this script to automate the process. It fixed my issue 100%.

I'm happy to share the script here, or I can provide it to the admins for testing. They can share it with everyone if approved or make it part of a new release.
ccrexet
ccrexet

Messages : 2
Date d'inscription : 2024-11-03
Age : 40
Localisation : Portugal

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by getupor 03/11/24, 10:07 am

Hello
Yes, please share, in that way @fredengie can test


[RESOLVED] Focus window issue on boot up Modo
getupor
getupor
Admin

Messages : 1388
Date d'inscription : 2020-10-04

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Aynshe 03/11/24, 11:56 am

yop, with c# code it seems to work, you compile and you have an executable for focus.

Edit2 : Tu peux ajouter un script dans start pour que le focus soit exécuté au lancement de RetroBat en laissant un petit timer au cas ou, ici j'ai laissé 10sec avant que focus s'exécute voici un pack https://www.mediafire.com/file/xkhhlrgsemt211b/RetroBat_Focus_rb_ES.7z/file :

le batch dans RetroBat\emulationstation\.emulationstation\scripts\start\focus.bat

Code:


@echo off
setlocal enabledelayedexpansion
for %%i in ("%cd%\..\..\..\..\plugins") do set "Focus_path=%%~fi"

ping localhost -n 10 > nul

start "Focus_rb_ES" "%Focus_path%\focus\Focus_rb_ES.exe" %*
exit /b
endlocal


Edit : voici la source et compilé : https://www.mediafire.com/file/iqgycyngpzgx5z7/Focus_rb_ES.7z/file , il faut de l'exécuter après, ou éventuellement poser un timer en batch et boucle sur une petite durée (spam le focus dans le code j'ai pas réussi, il semble y avoir une limité Windows pour éviter des soucis ou alors il faut une méthode agressive)
Toutefois généralement une vidéos de boot corrige aussi le problème.

Code:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;

static class Program
{
    [DllImport("user32.dll")]
    private static extern bool SetForegroundWindow(IntPtr hWnd);

    [DllImport("user32.dll")]
    private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

    private const int SW_RESTORE = 9;

    [STAThread]
    static void Main()
    {
        string processName = "emulationstation";
        Process[] processes = Process.GetProcessesByName(processName);

        if (processes.Length > 0)
        {
            IntPtr hWnd = processes[0].MainWindowHandle;
            ShowWindow(hWnd, SW_RESTORE);
            SetForegroundWindow(hWnd);
        }
    }
}


[RESOLVED] Focus window issue on boot up Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by fredengie 03/11/24, 09:22 pm

Bonjour,

toujours la même chose, si je ne click pas avec la souris sur la fenetre d emulation station je n ai pas les commandes avec mes joistick.
fredengie
fredengie

Messages : 10
Date d'inscription : 2024-11-02
Localisation : Belgium

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by tartifless 03/11/24, 09:24 pm

As-tu essayé en lançant emulationstation.exe et non retrobat.exe ?


[RESOLVED] Focus window issue on boot up Modo
tartifless
tartifless
Admin

Messages : 1642
Date d'inscription : 2021-04-27

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Aynshe 03/11/24, 09:33 pm

fredengie wrote:Bonjour,

toujours la même chose, si je ne click pas avec la souris sur la fenetre  d emulation station je n ai pas les commandes avec mes joistick.

curieux

édite : Si tu parle bien du plugin que je propose, j'ai aussi testé sur ma borne en win10 et pas de soucis, la manette prend la main directement après.

Soit tu n'applique pas le process correctement (il faut éventuellement ajuster la durée de temporisation dans le batch qui permet de lancer le plugin), soit tu a autre chose qui coince.

Tu peux vérifier le fonctionnement en exécutant l'exe depuis l'explorer tout en ayant ES en arrière plan.


[RESOLVED] Focus window issue on boot up Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

fredengie likes this post

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by fredengie 04/11/24, 06:32 am

Re,

Donc le exe fonctionne bien en manuel comme en automatique mais il ne réglé pas le soucis je dois faire un clic de souris sur l écran.

La seul alternative qui fonctionne chez moi:

Fair un kill de explorer au démarrage Windows avec le planificateur ensuite lancer retrobat par le planificateur avec un délai de 30 secondes.

Je n'utilise la machine que pour ma borne donc pas trop derrangeant .

Merci à vous pour votre aide et longue vie à retrobat

Ps: si les modos passe par ici, contactez-moi, vous ne serrez pas déçu.
fredengie
fredengie

Messages : 10
Date d'inscription : 2024-11-02
Localisation : Belgium

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by ccrexet 04/11/24, 11:20 am

Hello

Here is my script and instructions
link to Gdrive: Mouse1AutoClickArcade60Sec

Made by: Carlos Conceição - @ccrexet
Date: October 2024
Description:

This PowerShell script is designed to assist RetroBat in recognizing input controllers within an arcade cabinet setup.
While I used for the Ipac 2 in Xinput mode, it can also work for other types of controllers.
The script addresses the issue where Windows does not automatically bring RetroBat to the forefront of the user interface.
It begins by waiting for a specified duration (defaulted to 60 seconds, but adjustable as needed), then loads the necessary functions from `user32.dll` to control the mouse.
The script calculates the center position of the screen horizontally and one-fourth from the top vertically,
moves the mouse cursor to this position, and simulates a left mouse click. This automated interaction helps ensure that RetroBat gains focus,
allowing the input controllers to be properly detected and used.

**How to use the script**:
Place the script in any desired folder (it is recommended to place it in the RetroBat folder to keep everything organized).
Create a shortcut for this script and edit the shortcut. In the "Target" section, add:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File

before the path to the script. Finally, place the edited shortcut in the Windows Startup folder (shell:startup) to ensure it runs automatically when Windows starts.
ccrexet
ccrexet

Messages : 2
Date d'inscription : 2024-11-03
Age : 40
Localisation : Portugal

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by fredengie 04/11/24, 11:41 am

Hello,

Thx for your help.
I try this night


fredengie
fredengie

Messages : 10
Date d'inscription : 2024-11-02
Localisation : Belgium

ccrexet likes this post

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Aynshe 04/11/24, 05:47 pm

fredengie wrote:Re,

Donc le exe fonctionne bien en manuel comme en automatique mais il ne réglé pas le soucis je dois faire un clic de souris sur l écran.

La seul alternative qui fonctionne chez moi:

Fair un kill de explorer au démarrage Windows avec le planificateur ensuite lancer retrobat par le planificateur avec un délai de 30 secondes.

Je n'utilise la machine que pour ma borne donc pas trop derrangeant .

Merci à vous pour votre aide et longue vie à retrobat

Ps: si les modos passe par ici, contactez-moi, vous ne serrez pas déçu.

Hi,

I'm not trying to compete with the user who offers you a PS code.

But here is a version that in addition to the focus, adds a left click, note that for me this creates a click in the system selected by ES when opening.
I modified the method to make a slight movement so as not to open a system

https://www.mediafire.com/file/pf7ebi0gxixlgdl/RetroBat_Focus_and_mouse_left_rb_ES.7z/file

source c# :

Code:

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;

static class Program
{
    [DllImport("user32.dll")]
    private static extern bool SetForegroundWindow(IntPtr hWnd);

    [DllImport("user32.dll")]
    private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

    [DllImport("user32.dll")]
    private static extern bool GetWindowRect(IntPtr hWnd, out RECT rect);

    [DllImport("user32.dll")]
    private static extern bool SetCursorPos(int x, int y);

    [DllImport("user32.dll")]
    private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo);

    private const int SW_RESTORE = 9;
    private const uint MOUSEEVENTF_LEFTDOWN = 0x0002;
    private const uint MOUSEEVENTF_LEFTUP = 0x0004;

    [StructLayout(LayoutKind.Sequential)]
    private struct RECT
    {
        public int Left;
        public int Top;
        public int Right;
        public int Bottom;
    }

    [STAThread]
    static void Main()
    {
        string processName = "emulationstation";
        Process[] processes = Process.GetProcessesByName(processName);

        if (processes.Length > 0)
        {
            IntPtr hWnd = processes[0].MainWindowHandle;
            ShowWindow(hWnd, SW_RESTORE);
            SetForegroundWindow(hWnd);

            Thread.Sleep(1000);

            if (GetWindowRect(hWnd, out RECT rect))
            {
                int centerX = (rect.Left + rect.Right) / 2;
                int centerY = (rect.Top + rect.Bottom) / 2;

                SetCursorPos(centerX, centerY);

                mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);

                for (int i = 0; i < 10; i++)
                {
                    SetCursorPos(centerX - i, centerY);
                    Thread.Sleep(100);
                }

                Thread.Sleep(1000);

                mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
            }
        }
    }
}


[RESOLVED] Focus window issue on boot up Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

Back to top Go down

[RESOLVED] Focus window issue on boot up Empty Re: [RESOLVED] Focus window issue on boot up

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum