User Function for Cinematic Fades

Krakerman

Active member
RL Member
Hi guys,

I have attached my Global.ahk for the RocketLauncher\Lib\User Functions folder that wil allow you to play cinematic startup/shutdown fade videos in RocketLauncher.

You can configure the VLC path and where you have your fade in/out video folders at in the module.

Enjoy!

Note: Also added in additional code to hide the desktop code as well that works much better than the one in RLUI.
 

Attachments

  • Global.zip
    1.1 KB · Views: 22

Krakerman

Active member
RL Member
I added an additional setting to the code that will make sure the cinematic video is always on top.
 

Attachments

  • Global.zip
    1.3 KB · Views: 36

kris85

New member
RL Member
I added an additional setting to the code that will make sure the cinematic video is always on top.
Thanks for this file but I have 2 questions:

1. It's better to add your Settings to the existing Global file or directly from your file, if directly, won't it somehow conflict with Rl Hs because I have different settings in the original file?

2. Could you explain how it works and how to configure it, I changed the paths in the file, uploaded a video file Loading game over etc but nothing is displayed
I also have VLC
 

Pacifikballa

Member
RL Member
Here is what my Global.ahk looks like using MPC-HC media player to call my Fade videos:

class GlobalUserFunction extends UserFunction {

InitUserFeatures() {
Global dbName, systemName

; Initialize MPC-HC process
mpc := new Process(A_ScriptDir . "\Module Extensions\mpc-hc64.exe ")

; Fade In Video
fadeInVideoDir := new Folder(A_ScriptDir . "\Media\Fade Videos\")
defaultVideo := new File(fadeInVideoDir.FileFullPath . systemName . "\_Default.mp4")
gameVideo := new File(fadeInVideoDir.FileFullPath . systemName . "\" . dbName . ".mp4")
fadeVideo := If (gameVideo.Exist()) ? gameVideo : defaultVideo

; Launch fade video in MPC-HC
If (fadeVideo.exist())
mpc.RunWait("/fullscreen /play /close " . """" . fadeVideo.FileFullPath . """")
}

}


This is just currently for fade in videos. I didn't use the fade out portion of the original script. All you have to do is update the media player path, video path, and make sure to include any arguments to keep the video on top.
 

Attachments

  • Global.ahk
    682 bytes · Views: 9

djspindoc

New member
Hey,

I'm new to the forums and have been trying to get this working all day but no dice. Followed the instructions but no video will load. Is there something that needs to be set in RLUI? Any help would be appreciated. Thanks!
 

Pacifikballa

Member
RL Member
This is my spin on the OP's cinematic Fade In/Out. Unlike the original post, I do not use User Functions, but instead have it baked directly into the module. I also don't black out the screen before the video plays. So if that is something you want, take a look at the OP's module.

If you want both a fade_in and fade_out video, place a video named "fade_in" or "fade_out", inside the RocketLauncher\Media\Fade\"rom"\ folder. Thats it. No need for added directories like the OP's.

Here it is:

Place the Fade In part of the script at the top of the module you are using it with (in this example and in my modified modules, I place this right after StartModule() and BezelGui():

Code:
; Fade In Video
mpc := new Process(A_ScriptDir . "\Module Extensions\mpc-hc64.exe")
fadeIn := new File(A_ScriptDir . "\Media\Fade\" . systemName . "\" . romName . "\fade_in.*")
fadeEnabled := moduleIni.Read(romName . "|Fade Video", "Enable Fade Videos", "false",,1)


if (fadeEnabled == "true" && !fadeIn.Exist()) {
    ; If fade_in doesn't exist, play default video with any extension
    fadeIn := new File(A_ScriptDir . "\Media\Fade\" . systemName . "\_Default\_fade_in.*")
}


if (fadeEnabled == "true" && fadeIn.Exist()) {
    ; If fadeEnabled is true and there is a video available, run MPC-HC64
    mpc.Run("/fullscreen /play /close " . """" . fadeIn.FileFullPath . """")
}



Place the Fade Out part of the script after the emulator closes, in this example I am using the bottom part of the MAME module:

CloseProcess:

FadeOutStart()

If (networkSession && networkPlayers > 1) {
Loop % networkPlayers {
MameMultiPlayer%A_Index%Window.Close()
MameMultiPlayer%A_Index%Window.WaitClose()
}

} Else
emuPrimaryWindow.Close()

Code:
; Fade Out Video
        fadeOut := new File(A_ScriptDir . "\Media\Fade\" . systemName . "\" . romName . "\fade_out.*")


        if (fadeEnabled = "true" && !fadeOut.Exist()) {
            ; If fade_out doesn't exist, play default video with any extension
            fadeOut := new File(A_ScriptDir . "\Media\Fade\" . systemName . "\_Default\_fade_out.*")
        }


        if (fadeEnabled = "true" && fadeOut.Exist()) {
            ; If fadeEnabled is true and there is a video available, run MPC-HC64
            mpc.RunWait("/fullscreen /play /close " . """" . fadeOut.FileFullPath . """")
        }

Return


Now that we got the hard part out of the way, lets enable/disable Fade Videos, we need to add this inside the module's .isd:


Code:
<SECTION name="Fade Video" required="false">
    <SECTIONTYPE>Global</SECTIONTYPE>
    <KEYS>
        <KEY name="Enable Fade Videos" required="false" nullable="false">
            <KEYTYPE>String</KEYTYPE>
            <DESCRIPTION>
                Enables a captivating movie theater experience within the realm of gaming,
                as it enables the integration of fade-in videos for loading and fade-out videos
                for exit, ultimately elevating the overall gaming ambiance. (Default = False)
            </DESCRIPTION>
            <VALUES>
                <VALUE description="True">true</VALUE>
            </VALUES>
            <DEFAULT>false</DEFAULT>
        </KEY>
    </KEYS>
</SECTION>



Here is a link to my MAME.ahk module and .isd along with the mpc-h64 player. Just drop into your RocketLauncher directory. I will post up screenshots and other details tomorrow, but it is straight forward. If you have any questions, feel free to reach out. Thanks!

Cinematic Fade Videos


1704348896673.png
1704348931364.png
 

Pacifikballa

Member
RL Member
Breaking it down...

**Fade In Video**

Code:
mpc := new Process(A_ScriptDir . "\Module Extensions\mpc-hc64.exe")
Creates a new process object for the MPC-HC64 executable.

Code:
fadeIn := new File(A_ScriptDir . "\Media\Fade\" . systemName . "\" . romName . "\fade_in.*")
Defines a file object for the fade_in video specific to the system and ROM.

Code:
fadeEnabled := moduleIni.Read(romName . "|Fade Video", "Enable Fade Videos", "false",,1)
Reads the configuration setting for enabling fade videos from an INI file.

Code:
if (fadeEnabled == "true" && !fadeIn.Exist())
Checks if fade is enabled and fade_in video exists.
If fade is enabled but the fade_in video doesn't exist for the specific ROM, it sets `fadeIn` to a default fade_in video.
If fade is enabled and there's a video available, it runs MPC-HC64 in fullscreen mode to play the fade_in video.

**If you want the video to play first BEFORE loading the game, then use the RunWait command instead of just run:

Plays video while emulator/rom is loading:
Code:
mpc.Run("/fullscreen /play /close " . """" . fadeIn.FileFullPath . """")

Plays video first before emulator/rom is loaded:
Code:
mpc.RunWait("/fullscreen /play /close " . """" . fadeIn.FileFullPath . """")





**Fade Out Video**

Code:
fadeOut := new File(A_ScriptDir . "\Media\Fade\" . systemName . "\" . romName . "\fade_out.*")
Defines a file object for the fade_out video specific to the system and ROM.

Code:
if (fadeEnabled = "true" && !fadeOut.Exist())
Checks if fade is enabled and fade_out video exists.
If fade is enabled but the fade_out video doesn't exist for the specific ROM, it sets `fadeOut` to a default fade_out video.
If fade is enabled and there's a video available, it runs MPC-HC64 in fullscreen mode to play the fade_out video and waits for it to finish before continuing.


Example of the directory used for the Fade videos:

Code:
RocketLauncher
│
└── Media
    └── Fade
        ├── Arcade
        │   ├── term2
        │   │   ├── fade_in.*
        │   │   └── fade_out.*
        │   └── ROM2
        │       ├── fade_in.*
        │       └── fade_out.*
        ├── Sega Naomi
        │   ├── ninjaslt
        │   │   ├── fade_in.*
        │   │   └── fade_out.*
        │   └── hotd2
        │       ├── fade_in.*
        │       └── fade_out.*
        └── _Default
            ├── _fade_in.*
            └── _fade_out.*


This directory tree represents the structure of the `RocketLauncher\Media\Fade` directory, where fade_in and fade_out videos are stored for different systems and ROMs. The `_Default` directory contains default videos to be used when a specific ROM's video is not available.


Here are a list of the parameters that can be used with the MPC-H64 media player:

Code:
Usage: mpc-hc.exe "pathname" [switches]


"pathname"    The main file or directory to be loaded
        (wildcards allowed, "-" denotes standard input)
/dub "dubname"    Load an additional audio file
/dubdelay "file"    Load an additional audio file shifted with XXms
        (if the file contains "...DELAY XXms...")
/d3dfs        Start rendering in D3D fullscreen mode
/sub "subname"    Load an additional subtitle file
/filter "filtername"    Load DirectShow filters from a dynamic link library (wildcards allowed)
/dvd        Run in DVD mode, "pathname" means the DVD folder (optional)
/dvdpos T#C    Start playback at title T, chapter C
/dvdpos T#P    Start playback at title T, position P (hh:mm:ss)
/cd        Load all the tracks of an Audio CD or (S)VCD,
        "pathname" means the drive path (optional)
/device        Open the default video device
/open        Open the file, don't automatically start playback
/play        Start playing the file as soon the player is launched
/close        Close the player after playback (only works when used with /play)
/shutdown    Shutdown the operating system after playback
/standby        Put the operating system in standby mode after playback
/hibernate        Hibernate operating system after playback
/logoff        Log off after playback
/lock        Lock workstation after playback
/monitoroff    Turn off the monitor after playback
/playnext        Open next file in the folder after playback
/fullscreen    Start in fullscreen mode
/viewpreset N    Start with specific preset,
        where N is either "1" Minimal, "2" Compact or "3" Normal
/minimized    Start in minimized mode
/new        Use a new instance of the player
/add        Add "pathname" to playlist, can be combined with /open and /play
/randomize    Randomize the playlist
/volume N    Set Volume, where N is a range from 0 to 100
/regvid        Create file associations for video files
/regaud        Create file associations for audio files
/regpl        Create file associations for playlist files
/regall        Create file associations for all supported file types
/unregall        Remove all file associations
/start ms        Start playing at "ms" (= milliseconds)
/startpos hh:mm:ss    Start playing at position hh:mm:ss
/fixedsize w,h    Set a fixed window size
/monitor N    Start player on monitor N, where N starts from 1
/audiorenderer N    Start using audiorenderer N, where N starts from 1 (see "Output" settings)
/shaderpreset "Pr"    Start using "Pr" shader preset
/pns "name or values"    Specify Pan & Scan preset name to use or direct position and zoom values in format "px,py,zx,zy"
/iconsassoc    Reassociate format icons
/nofocus        Open MPC-HC in background
/webport N    Start web interface on specified port
/debug        Show debug information in OSD
/nocrashreporter    Disable the crash reporter
/slave "hWnd"    Use MPC-HC as slave
/hwgpu "index"    Set the index of the GPU used for hardware decoding.
        Only available for CUVID and DXVA2 (copy-back)
/reset        Restore default settings
/mute        Mute the audio
/help /h /?    Show help about command line switches
 
Last edited:
Top