[RESOLVED] Focus window issue on boot up
+5
Aynshe
Lorenzolamas
docam30
FiveOver014
agentsmith6403
9 posters
Page 1 of 1
[RESOLVED] Focus window issue on boot up
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- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 30
Date d'inscription : 2023-12-20
mattwu64 and docam30 like this post
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
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?
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- Messages : 30
Date d'inscription : 2023-12-20
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 30
Date d'inscription : 2023-12-20
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
Is there a safe way to reinstall without losing setup data?
agentsmith6403- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 30
Date d'inscription : 2023-12-20
Re: [RESOLVED] Focus window issue on boot up
Hi again. After reinstalling retrobat the intro video now works and the video is in focus. Thanks for your help with this.
agentsmith6403- Messages : 28
Date d'inscription : 2024-02-14
Re: [RESOLVED] Focus window issue on boot up
Glad you where able to get Retrobat up and running. Happy Retro Gaming!
FiveOver014- Messages : 30
Date d'inscription : 2023-12-20
getupor likes this post
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 14
Date d'inscription : 2024-02-25
Re: [RESOLVED] Focus window issue on boot up
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.
-------------- Please -------------
The board rules: https://retrobat.forumgaming.fr/t51-read-befor-posting-retrobat-forum-rules
BEFORE POSTING !!!!
READ:
English FAQ: https://retrobat.forumgaming.fr/t135-faq-retrobat-wip
French FAQ: https://retrobat.forumgaming.fr/t136-faq-retrobat-wip
Spanish FAQ: https://retrobat.forumgaming.fr/t854-faq-retrobat-wip
Retrobat Wiki (english & french): https://wiki.retrobat.org/
and:
Choose an avatar: https://retrobat.forumgaming.fr/t1190-avatar-how-to-choose-an-avatar-on-the-forum
and say "Hello"
Lorenzolamas- Admin
- Messages : 2650
Date d'inscription : 2019-07-28
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 14
Date d'inscription : 2024-02-25
Re: [RESOLVED] Focus window issue on boot up
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 ?
Aynshe- Messages : 445
Date d'inscription : 2022-03-18
Re: [RESOLVED] Focus window issue on boot up
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
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- Messages : 30
Date d'inscription : 2023-12-20
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 14
Date d'inscription : 2024-02-25
Re: [RESOLVED] Focus window issue on boot up
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...
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- Messages : 30
Date d'inscription : 2023-12-20
Re: [RESOLVED] Focus window issue on boot up
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).
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- Messages : 14
Date d'inscription : 2024-02-25
Re: [RESOLVED] Focus window issue on boot up
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.
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 and no more focus issues.
docam30- Messages : 14
Date d'inscription : 2024-02-25
Re: [RESOLVED] Focus window issue on boot up
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.
Aynshe- Messages : 445
Date d'inscription : 2022-03-18
Re: [RESOLVED] Focus window issue on boot up
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- Messages : 14
Date d'inscription : 2024-02-25
Re: [RESOLVED] Focus window issue on boot up
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.
Aynshe- Messages : 445
Date d'inscription : 2022-03-18
docam30 likes this post
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 2
Date d'inscription : 2024-11-03
Age : 40
Localisation : Portugal
getupor- Admin
- Messages : 1421
Date d'inscription : 2020-10-04
Re: [RESOLVED] Focus window issue on boot up
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
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.
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);
}
}
}
Aynshe- Messages : 445
Date d'inscription : 2022-03-18
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 10
Date d'inscription : 2024-11-02
Localisation : Belgium
Re: [RESOLVED] Focus window issue on boot up
As-tu essayé en lançant emulationstation.exe et non retrobat.exe ?
tartifless- Admin
- Messages : 1674
Date d'inscription : 2021-04-27
Re: [RESOLVED] Focus window issue on boot up
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.
Aynshe- Messages : 445
Date d'inscription : 2022-03-18
fredengie likes this post
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 10
Date d'inscription : 2024-11-02
Localisation : Belgium
Re: [RESOLVED] Focus window issue on boot up
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.
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- Messages : 2
Date d'inscription : 2024-11-03
Age : 40
Localisation : Portugal
Re: [RESOLVED] Focus window issue on boot up
Hello,
Thx for your help.
I try this night
Thx for your help.
I try this night
fredengie- Messages : 10
Date d'inscription : 2024-11-02
Localisation : Belgium
ccrexet likes this post
Re: [RESOLVED] Focus window issue on boot up
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,
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);
}
}
}
}
Aynshe- Messages : 445
Date d'inscription : 2022-03-18
Similar topics
» [RESOLVED] How to disable boot on startup
» [RESOLVED] Autostart after windows boot, but not active
» [RESOLVED] Retrobat taking multiple times to boot into any emulator
» [RESOLVED]N-Gage controller issue
» [RESOLVED] PCSX2 Plugin Issue
» [RESOLVED] Autostart after windows boot, but not active
» [RESOLVED] Retrobat taking multiple times to boot into any emulator
» [RESOLVED]N-Gage controller issue
» [RESOLVED] PCSX2 Plugin Issue
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum