Jump to content
LaunchBox Community Forums

Recommended Posts

Hi everybody.
Here I come to you because I would like to know if it was possible 
to make a script to launch such or such core according to the hour?
let me explain.
take the Nintendo Famicom for example.
Nintendo Famicom Dayly.Dll would launch from 7:00 a.m. to 9:00 p.m.
Nintendo Famicom Nightly.dll from 9:00 p.m. to 6:00 a.m.
Why?
All is a question of shaders I have a day version as well as a night version. 
history of perfecting as much as possible this magnificent front end which is LB / BB
thanks for your help if by any chance someone has the solution i think i would be the happiest man!

As exemple Day versiond07cf1250d1689b955e938fa6cbf30dc08aa75e3_2_690x388.thumb.jpg.fb2b1f7c1df19e0087c84c7084c55394.jpg

Night Version

a30307b52b09ec02958ad41d5b2cdf313ba55b94_2_690x388.thumb.jpg.5e9db69d46d2e7f011287fb638dfe118.jpg

Edited by RetroFanZ
  • Like 1
Link to post
Share on other sites

Easiest way (I can think of) is to create a new Emulator similar to the steps listed here: 

The script portion is, of course going to be different and you'll need to make one for each Platform (or make 1 that's a_litTLe_moRre_coMpLEx).

Sample Famicom Platform:

romPath = %1%
If A_Hour >= 07 and A_Hour <= 21 
  Run, "D:\Emulators\retroarch\retroarch.exe" -L "D:\Emulators\retroarch\cores\Nintendo Famicom Dayly.Dll" "%romPath%", 1
else
  Run, "D:\Emulators\retroarch\retroarch.exe" -L "D:\Emulators\retroarch\cores\Nintendo Famicom Nightly.Dll" "%romPath%", 1

Adjust the paths to your retroarch.exe and to your cores.

  • Thanks 1
Link to post
Share on other sites

wow thx i'll try it right now!

hey :)

I've change hour for testing but nothing happened.

i've create a new emulator in LB called retroarch famicom i'v point everythings correctly and then copy your script in the script hotkey Tab

nothing changed ;(

 

Edited by RetroFanZ
Link to post
Share on other sites
1 hour ago, RetroFanZ said:

and then copy your script in the script hotkey Tab

I don't recall writing that step. ;)  So we'll start again from scratch (with a little better details).

1)    Create a new text file and save it to somewhere you won't forget nor accidentally delete.  Say somewhere like "D:\LaunchBox\ThirdParty\AutoHotkey\MyAHKs\"

2)    Inside that text file, put:

romPath = %1%
If A_Hour >= 07 and A_Hour <= 21 
  Run, "D:\Emulators\retroarch\retroarch.exe" -L "D:\Emulators\retroarch\cores\Nintendo Famicom Dayly.Dll" "%romPath%", 1
else
  Run, "D:\Emulators\retroarch\retroarch.exe" -L "D:\Emulators\retroarch\cores\Nintendo Famicom Nightly.Dll" "%romPath%", 1

3)    Now save the file, but save it with an "ahk" file extension.  Say something like "FamicomScript.ahk".  (make sure it doesn't save as "FamicomScript.ahk.txt")

4)    In LaunchBox, click Tools and select Manage Emulators.

5)    Click Add...

6)    Under Emulator Name:, give it a name.  Say something like "retroarch famicom".

7)    Where it says Emulator Application Path: click Browse and navigate to your ../LaunchBox/ThirdParty/AutoHotkey/ folder and select AutoHotkey.exe.

😎   Where it says Default Command-Line Parameters:, type in the full path to where you saved the file you created above. And put quotes around it.

9)    Leave all boxes unchecked.

10)  The Sample Command-Line should look like

AutoHotkey.exe "D:\LaunchBox\ThirdParty\AutoHotkey\MyAHKs\FamicomScript.ahk" "FULL\PATH\TO\ROM\FILE"

11)   Click on the Associated Platforms tab.

12)   In the Associated Platform cell, type in the name of your Platform EXACTLY as spelled, including upper and lowercase letters. As you start to type, you should see a combobox in which you can select the proper Platform.

13)   Check the box for Default Emulator.  It'll ask something like 'You sure?' and 'Do you want to make this the default for games in this Platform'.  Yes.

14)   Click OK.  Click Close.

15)   Play games.

image.thumb.png.a064edf9149477d78d358db063a0faaa.pngimage.thumb.png.001627eb62f1428a3ecfb65cbd62a8ec.png

  • Thanks 2
Link to post
Share on other sites
after several tests I decided to run a config backup to verify that the night core was activated and it turns out that apparently it does not take into account the time slot. 
may be that it only works on time precise.i continue my tests and keep you posted anyway thank you for this very detailed tutorial and the time you devote to me! thanks again
Edited by RetroFanZ
Link to post
Share on other sites

i've try 

romPath = %1%
If A_Hour >= 07 and A_Hour <= 21
  Run, "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Jour\retroarch.exe" -L "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Jour\cores\Sega Saturn.Dll" "%romPath%", 1
If A_Hour >= 21 and A_Hour <= 07
  Run, "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Nuit\retroarch.exe" -L "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Nuit\cores\Sega Saturn Nightly.dll" "%romPath%", 1

but it launch both configurations lol.nightly is reconized lol...:)

Link to post
Share on other sites

@RetroFanZ Launches both?  That's not good. lol  

The "and" doesn't seem to doing what [I think] it's supposed to.  Also you shouldn't the 2nd "If" statement. 

Time for Plan "B". ;) 

romPath = %1%
If A_Hour between 07 and 21
  Run, "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Jour\retroarch.exe" -L "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Jour\cores\Sega Saturn.Dll" "%romPath%", 1
else
  Run, "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Nuit\retroarch.exe" -L "F:\Emulateurs\RetroArch - Sega Saturn\Sega Saturn - Nuit\cores\Sega Saturn Nightly.dll" "%romPath%", 1

 

  • Thanks 1
Link to post
Share on other sites

Ok it dosent' work in the same hour so...i made a test actualy for me it's 23h50.

imade different hours for test

If A_Hour between 07:01 and 23:48 don't work

If A_Hour between 07:01 and 23:00 don't work

If A_Hour between 07:01 and 22:59 WORKING

 

So i think we must do

If A_Hour between 06:59 and 20:59 for working perfectly.

weird bug or just a script can't be precise and see every minutes in the same hour as the absolute same hour.

  • Like 1
Link to post
Share on other sites

Well, I didn't change my system clock to test it. lol   But ya, finetuning the variables definitely gets it more precise. in fact may want to change the upper limit.

If A_Hour between 06:59 and 21:01

That way "7" and "21" are BETWEEN the two in the true sense of the word. :D

  • Thanks 1
Link to post
Share on other sites
14 hours ago, RetroFanZ said:

weird bug or just a script can't be precise and see every minutes in the same hour as the absolute same hour.

I looked into this a little...  A_Hour only returns a two digit (whole) number (00-23).  So we only got "lucky" when we changed what we thought would be the minutes, when in fact it was the 'hour' change (from 23 to 22) that made it work. lol  We live and learn.

11 hours ago, RetroFanZ said:

how can we point the config file?

I don't know what the command line parameter is to load a config file for RetroArch.   If you know what is, it can be added to the "Run" statement in the script.  But if you're loading different ones for different games (vs different Platforms) it could get tricky.

  • Game On 1
Link to post
Share on other sites

retroarch.exe

21 minutes ago, JoeViking245 said:

I don't know what the command line parameter is to load a config file for RetroArch. 

From an example I have:

Run, D:\Emulators\RetroArch\retroarch.exe -L D:\Emulators\RetroArch\cores\mednafen_saturn_libretro.dll -c "D:\Emulators\RetroArch\config\mednafen_saturn_libretro.cfg" "D:\Games\Sega Saturn\Daytona USA Championship Circuit Edition (USA)\Daytona USA Championship Circuit Edition (USA).chd"

But RetroArch also has a --appendconfig parameter which let you append a custom config to existing configs:

--appendconfig PATH
              Appends a different set of config files  to  the  config  file  loaded  in  -c  (or
              default).   Multiple  config files are delimited by ','.  Every config file will be
              appended in order where the key-value pairs of the next config file takes  priority
              over the old ones.
Edited by Koroth
  • Game On 1
Link to post
Share on other sites

i found a solution not the easiest but it's ok.creat a retroarch folder per system.we can't ATM point the config file in the config folder so it automaticaly point the co,nfig in the root of retroarch so as example i' create 2 folders Sega Saturn Day and sega Saturn Night.it's preaty cool i can custom my retroachievement sound per system! ;)

Link to post
Share on other sites

i koroth i've test it like that

romPath = %1%
If A_Hour between 06:59 and 20:59
  Run, "F:\Emulateurs\RetroArch\retroarch.exe" -L "F:\Emulateurs\Retroarch\cores\Sega Saturn.Dll" -c "F:\Emulateurs\RetroArch\config\Sega Saturn\Sega Saturn.cfg"  "%romPath%", 1
else
  Run, "F:\Emulateurs\RetroArch\retroarch.exe" -L "F:\Emulateurs\RetroArch\cores\Sega Saturn Nightly.Dll" -c "F:\Emulateurs\RetroArch\config\Sega Saturn Nightly\Sega Saturn Nightly.cfg" "%romPath%", 1

in my principal set up but it launch a command window 1 sec ant nothing

Edited by RetroFanZ
Link to post
Share on other sites

ok....


romPath = %1%
If A_Hour between 06:59 and 20:59
  Run, "RETROARCH\PATH" -L "CORE\PATH\DAY.Dll" -c "CONFIG\PATH\DAY.cfg" "%romPath%", 1
else
  Run, "RETROARCH\PATH" -L "CORE\PATH\NIGHT.Dll" -c "CONFIG\PATH\NIGHT.cfg" "%romPath%", 1

Here is the final script Just Works Perfectly. Thx to every one!

in fact if u wana do that i separate my config files like that:

Retroarch

     Config

          Sega Saturn

                    Beetle Saturn

                    Sega Saturn.cfg

          Sega Saturn - Nightly

                    Beetle Saturn

                    Sega Saturn - Nightly.cfg

          Super Nintendo Entertainment system

                    SNES9X

                    Super Nintendo Entertainment system.cfg

          etc...for all my systems

just point the config folder in the folder configuration in retroarch.

then create 2cores 1 day and 1 night apply the proper shader do each and then save.

follow the tutorial above and th' ats it! pretty good not necessary but impressive IMO.

Thanks again.

  

  • Like 1
  • Game On 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...