Join Us and become a Member for a Verified Badge to access private areas with the latest PS4 PKGs.
PS4 CFW and Hacks       Thread starter PSXHAX       Start date Dec 5, 2020 at 1:22 AM       7      
Status
Not open for further replies.
Recently developer JorP shared on his Blog a Python script dubbed ps4_automate that will automate the first two levels of the PS4 puzzle game Active Neurons via Chiaki for those interested in learning about PlayStation 4 input automation with a demonstration video from his YouTube Channel below. :geek:

Download: ps4_automate-master.zip / GIT

This PlayStation 4 (PS4) Scene news comes following the Grand Theft Auto Online PS4 Bunker Automation Utility, PySnakeGame PS4 Controller Script and Final Fantasy X PS4 HD Remaster Thunder Dodger Script with details from his PS4 Automate Blog Post to quote:

I’ll start this one off by stating that I’m not as much of as a gamer as I used to be, it’s a shame, but interests change over time.

What better way to combine hobbies of new with hobbies of old than with automation?

There’s a great little puzzle game out there called Active Neurons that I enjoyed once upon a time ago. The thing about this particular puzzler is that the first two stages (white and blue) are completely static. Meaning, there are no adversary mechanics to interfere with the player’s movement until the third stage.

Fore some reason, I took it upon myself to learn how to automate these first two levels, not because it’s difficult, but because it had to be possible and I was curious to find out how.

Watch it in action or try it yourself with my code.

How did I do this?

Chiaki


Surprisingly, it didn’t take much searching to come across a quality FOSS PS4 Remote Play client. Chiaki was extremely promising and worked flawlessly.

Building on Fedora 33

NOTE
: Desktop Environments on Xorg only, Wayland is not supported

The instructions to build from source are found within the repo and I’ve provided package names below to save yourself some internet searches and cmake failures.

Note: ffmpeg-devel must be obtained from RPMfusion free:
Code:
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
Code:
sudo dnf install -y cmake gcc-c++ python3-protobuf protobuf-compiler opus-devel openssl-devel qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qtsvg-devel SDL2-devel ffmpeg-devel
Usage

The author of Chiaki lists usage instructions within the repository, be careful and fully examine them before executing any code.

There is one particular step where you’ll need to run a provided script in order to obtain your PSN account ID, make sure to audit the code before running it.. providing your credentials to python script mentioned by a random blog such as mine is a great way to get phished, don’t trust anything. The beauty of FOSS is that you can view and modify the code yourself, take advantage of that!

That being said, if you prefer to use an AppImage from the author, it is also available here.

Targeting the Remote Play client window

wmctrl


I used the following lazy but useful wmctrl and grep pipeline in order to find the correct Chiaki window identity in hexadecimal.
Code:
wmctrl -l | grep '[C]hiaki | Stream' | grep -Eo '0x[0-9a-f]+'
xdotool

After grabbing the proper window ID, I used xdotool to activate and focus my target Chiaki window. With the stream window focused, you’ll now be able to send simulated keyboard input that correspond with the default key bindings for Chiaki (that map to buttons on the DualShock 4 controller.

Input files

My script takes an input file of multiplier and button combinations, separated by new lines of the following format:
Code:
[multiplier]button_shorthand
where multiplier is optional and button_shorthand can be found below. I tried to make button_shorthand as mnemonic as possible.

Keymap table

ps4_button chiaki_default xdotool_key_code button_shorthand
Circle Backspace 0xff08 c
Triangle C 0x0043 t
X Return 0xff0d x
Square \ 0x005c s
D-Pad Right Right 0x08fd dr
D-Pad Down Down 0x08fe dd
D-Pad Left Left 0x08fb dl
D-Pad Up Up 0x08fc du
R1 3 0x0033 r1
R2 4 0x0034 r2
R3 6 0x0036 r3
L1 2 0x0032 l1
L2 1 0x0031 l2
L3 5 0x0035 l3
Left Stick Left [ 0x005b ll
Left Stick Down Del 0xffff ld
Left Stick Right ] 0x005d lr
Left Stick Up Ins 0xff63 lu
Right Stick Left - 0x002d rl
Right Stick Down Page_Down 0xff56 rd
Right Stick Right = 0x003d rr
Right Stick Up Page_Up 0xff55 ru
Share F 0x0046 sh
PS Esc 0xff1b ps
Options O 0x004f op
Touchpad T 0x0054 tp
Putting it all together

I provided some sample input files for the first two stages (white and blue) of Active Neurons.

To loop through an entire stage at once:
Code:
for stage in $(seq -f white"%02g" 1 10); do ./ps4_automate.py games/active_neurons/white/$stage; done
While this mainly serves to solve a niche puzzle game, I would imagine that this could be used for repetitive key sequence(s) as well.

Automate Active Neurons White Stage
Active Neurons PS4 Puzzle Game Input Automation Demo by JorP.jpg
 

Comments

I've made Chiaki modified Mac version which makes it possible to send keystrokes from Apple Script to active remote play session window. It is also not required for window to be in foreground. Got required fatalities to open chests with MK11 with AI

Can share it as well as the script if someone needs it, just let me know
 
Status
Not open for further replies.
Back
Top