Jump to content
  • Announcement

    The HyperSpin 2 early access beta is here!

    We’re starting the first public testing phase with Platinum Members to keep the scope manageable while we test the current feature set and begin to add more. In the future, we’ll provide a version for basic members as well.  On behalf of the entire HyperSpin team, we look forward to another exciting adventure with our community.

Getting PCSX2 module to run scripts prior to launching a specific game in Hyperspin


wderbi

Recommended Posts

Posted

Hello all.  I am pretty sure that my limited understanding of how modules can be modified is not allowing me to come up with the solution on my own, but it is and I am stuck!  I have been setting up Aimtrak guns to work with PS2 shooters using the procedure detailed by Argonlefou over at Arcadecontrols

http://forum.arcadecontrols.com/index.php/topic,151385.msg1582349.html#msg1582349[/CODE] 


I went through the procedure and got the games working as I want them to work with the guns, and I saved the ini files for each game in a folder named for each of the shooting games as suggested.  Each folders has the following files:  nuvee_ps2_usb_main.ini and nuvee_ps2_usb_guncon1.ini, while a few have nuvee_ps2_usb_guncon2.ini as well.  The tutorial suggest creating an AHK script that will write/overwrite the files into the inis folder within the PCSX2 subdirectory tree and launch the specific game, but it is not for use in a frontend like Hyperspin.  As a test, I created a modified AHK that will write files to the inis folder, but will not launch the game.  The script works very well if I was to double-click it to execute it prior to starting the emulator to launch the Endgame rom.  The game works just fine with the Aimtraks, and I am happy with using default settings for everything else in the emulator---the only change will be adding those 3 files to the inis folder for the 8 or 9 shooters I have set up.  The lines for my AHK Script are as follows:

;Copying Nuvee configuration and Endgame game profile
FileCopy, H:\HyperSpin\Emulators\PCSX2 1.4.0\game inis\Endgame\nuvee_ps2_usb_guncon1.ini, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis, 1
FileCopy, H:\HyperSpin\Emulators\PCSX2 1.4.0\game inis\Endgame\nuvee_ps2_usb_guncon2.ini, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis, 1
FileCopy, H:\HyperSpin\Emulators\PCSX2 1.4.0\game inis\Endgame\nuvee_ps2_usb_main.ini, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis, 1

 

What I would like to accomplish is to execute this script prior to running the game in Hyperspin.  In other modules such as PClauncher, you are able to run executables and batch files pre and post launch, and post quit for each game you choose and on a game-specific basis.  Unfortunately, there is no such option in RLUI to do so in the PCSX2 module settings...It appears that only game-specific options in PCSX2 module is to modify game-specific settings and apply GS hacks for that game.  I tried last night adding a game in the global module settings and going through setting up the plugins, but I could not get it to write and then overwrite guncon 1, guncon2, and main settings in the inis folder---unless I am doing something wrong.  I am trying to avoid the cumbersome approach of running several versions of the emulator with game-specific command-line options...Is there a way to modify the PCSX2.ahk to allow running pre-postlaunch AHK scripts/executables/bat files as in PClauncher?

Thanks!!!

PS>I posted a thread similar to this in RL forums...hopefully someone here can also chime in!

Posted

I got a response from Agent47 on the RL forums, and I really want to thank him for alerting me to the "User Functions" option for modifying how RocketLauncher functions.  Basically, Agent 47 described the User Functions feature as not really an selectable option in RocketLauncherUI, but that it is more of a set of files that allow you to write AHK code to run at various points while RL is running. The user options are located in the RocketLauncher/Lib folder.

Well, I followed the suggestion of using user functions to accomplish this.  I have to admit though...it literally took me two or three HOURS to get this done.:stupid:  The whole user options thing in regards to how to set up a specific function is not very clearly explained in the wiki on that site, nor anywhere that can be easily searched on the web. I think the wiki does do a decent job of explaining the concepts of user function options, but leaves a lot to be desired as far as presenting a few simple examples of how to get it to work...a few simple example scripts for each likely scenario a user might encounter would go a long way!

That being said, I finally figured out that all I had to do was to modify the "GameName-Example" script found in the "Rocketlauncher\Lib\User Functions" folder.  I first created a folder named "Sony Playstation 2" (exact match of the 'system' name) in the "Rocketlauncher\Lib\User Functions" folder, and I then copied the "GameName-Example" script into the newly created Sony Playstation 2 folder.  I then renamed the GameName-Example folder the exact same name of the Rom file which is Endgame (USA).  I then copied the 4 lines of text into the AHK file under the "InitUserFeatures" section as described below:

; Use this function to define any code you want to run on initialization
    InitUserFeatures() {
        RLLog.Info(A_ThisFunc . " - Starting")
        ;Copying Nuvee configuration and Endgame game profile
FileCopy, H:\HyperSpin\Emulators\PCSX2 1.4.0\Game Configs\Endgame (USA)\nuvee_ps2_usb_guncon1.ini, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis, 1
FileCopy, H:\HyperSpin\Emulators\PCSX2 1.4.0\Game Configs\Endgame (USA)\nuvee_ps2_usb_guncon2.ini, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis, 1
FileCopy, H:\HyperSpin\Emulators\PCSX2 1.4.0\Game Configs\Endgame (USA)\nuvee_ps2_usb_main.ini, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis, 1

        RLLog.Info(A_ThisFunc . " - Ending")
    }

Unfortunately, it did not work! :hmmmm2: I then tried putting into the "StartUserFeatures" section, and it did not work.  I tried removing all other sections but the sections with the code, again no worky!  I even tried making separate AHK scripts and/or converting them to executables (exe) files, and tried using the Run, "file path" option like below:

; Use this function to define any code you want to run on initialization    
    InitUserFeatures() {
        RLLog.Info(A_ThisFunc . " - Starting")
        ;Copying Nuvee configuration and Endgame game profile
        Run, H:\HyperSpin\Emulators\PCSX2 1.4.0\Game Configs\Endgame config.exe    

        RLLog.Info(A_ThisFunc . " - Ending")
    }

Again, it did not work.  Finally, I tried executing both the AHK I wrote yesterday (that worked on yesterday!) and tried to just run the executable that I compiled today using that same AHK script, but again...NOTHING!  Now I am really wondering what's going on!  Why did the script no longer work?  My "Ah Ha!" moment finally came---a mere 3+ hours after I started this venture today.  Turns out that I made only a slight change to the folder where the USB inis for the light guns were stored...I added (USA) to the name to match the ROM when I tried playing with Game Config options in RLUI last night.  What an idiot oversight on my part!  Once I made the change, everything works whether I add the four code lines, or whether I use the "Run," option for either the AHK script or the complied EXE file.  I started feeling good about myself and so I wrote another AHK script to remove the ini files from the "INIS" subfolder for PCSX2, and now the files are removed after the module closes:

; Use this function to define any code you may need to stop or clean up in every module on exit
    StopUserFeatures() {
        RLLog.Info(A_ThisFunc . " - Starting")
        ;Removing Nuvee configuration and Endgame game profile
FileDelete, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis\nuvee_ps2_usb_guncon1.ini
FileDelete, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis\nuvee_ps2_usb_guncon2.ini
FileDelete, H:\HyperSpin\Emulators\PCSX2 1.4.0\inis\nuvee_ps2_usb_main.ini

        RLLog.Info(A_ThisFunc . " - Ending")
    }

I also compiled an executable from the "remove files" script, and generated my final User Function script using the EXE files since it looks a lot neater.  I removed all of the extraneous text from the file as well:

class GameUserFunction extends GameFunction {

; Use this function to define any code you want to run on initialization    
    InitUserFeatures() {
        RLLog.Info(A_ThisFunc . " - Starting")
        ;Copying Nuvee configuration and Endgame game profile
        Run, H:\HyperSpin\Emulators\PCSX2 1.4.0\Game Configs\Endgame config.exe  

        RLLog.Info(A_ThisFunc . " - Ending")
    }

; Use this function to define any code you may need to stop or clean up in every module on exit
    StopUserFeatures() {
        RLLog.Info(A_ThisFunc . " - Starting")
       ;Removing Nuvee configuration and Endgame game profile
        Run, H:\HyperSpin\Emulators\PCSX2 1.4.0\Game Configs\remove files from inis.exe

        RLLog.Info(A_ThisFunc . " - Ending")
    }
    
}

I made all of my PS2 shooting games into separate AHKs and EXE files and everything works well finally after 2-3 days playing with the PS2 shooters.  I hope this long post will be helpful to anyone else trying to set this up!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...