Author Topic: [Plugin WIP] SavestateLoader (only for retroarch-windows)  (Read 240 times)

qqplayer

  • Sr. Member
  • ****
  • Posts: 282
    • View Profile
[Plugin WIP] SavestateLoader (only for retroarch-windows)
« on: August 26, 2019, 10:12:44 AM »
This plugin allows you to launch your retroarch savestates directly from AM.



Inspiration:
https://retropie.org.uk/forum/topic/15029/savestate-loading-from-es-like-on-snesmini-with-screenshot

First of all Im not responsable for .cfg corrupted filed, lost savestates...
Use the plugin under your own responsability.
Be aware that the plugin deletes the main auto savestate file from your retroarch folder.

As always I must thank all the community for the help (specially keilmillerjr).

So, Ill try to explain how it works.All paths and config files should be precisely created, otherwise the plugin doesnt work propertlly.
Steps:

retroarch.cfg (emulator main .cfg file)

Code: [Select]
savestate_auto_index = "false"
savestate_auto_load = "true"
savestate_auto_save = "false"
savestate_directory = ":\states"
savestate_thumbnail_enable = "true"
savestates_in_content_dir = "false"
auto_overrides_enable = "false"



emulator.cfg (AM emulator example .cfg file to understand where you need to create your appendconfig_emulator.cfg file)

Code: [Select]
# Generated by Attract-Mode v2.2.1
#
executable           cmd
args                 /c cd "Y:\Attrack Mode\systems\RetroArch" & start /wait retroarch -L cores\emulator.dll "[romfilename]" --appendconfig "Y:\Attrack Mode\systems\RetroArch\config\AutoSavestate\appendconfig_emulator.cfg"

Every emulator (AM) needs an 'appendconfig_emulator.cfg'

appendconfig_emulator.cfg
Code: [Select]
savestate_directory = ":\states\emulator"

I'm using 'emulator' as the main name, should be 'Atari 5200','Game Boy'...

Inside your retroarch installation should be a states folder.
A hard link shell shortcut needs to be created from the emulator to the plugin folder.



This program can make it and its free.
http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html

atract.cfg  (AM main .cfg file)

Code: [Select]
plugin SavestateLoader
enabled              yes
param                command SavestateLoader.bat
param                extension_1 .state1
param                extension_2 .state2
param                extension_3 .state3
param                slash /

To launch your savestates you need to asign three 'signal_str' , I've chosen this ones.

Code: [Select]
input_map
toggle_rotate_right  T
toggle_flip          Y
toggle_rotate_left   U


Quote
input_map
   toggle_rotate_right  T ("savestate_1")
   toggle_flip          Y ("savestate_2")
   toggle_rotate_left   U ("savestate_3")


https://github.com/mickelson/attract/blob/master/Layouts.md#add_signal_handler

plugin.nut  (plugin main .nut file)

Code: [Select]
show_statesnap ---> fe.get_input_state ("G")
hide_statesnap ---> fe.get_input_state ("H")

Default keys to show or hide your savestates.






And that's it  ;)



EXTRA: SavestateClear.bat THIS FILE DELETES THE .STATE.AUTO FILE WHEN YOU RETURN FROM THE GAME.
It doesnt matter because its a copy of your .state1, .state2 or .state3 file.
But I advise you to test the plugin propertly creating and launching your savestates before putting this file alongside your plugin.nut
« Last Edit: August 26, 2019, 10:57:58 AM by qqplayer »

jedione

  • Hero Member
  • *****
  • Posts: 768
  • punktoe
    • View Profile
Re: [Plugin WIP] SavestateLoader (only for retroarch-windows)
« Reply #1 on: August 26, 2019, 11:15:07 AM »
very good.....great project.
help a friend....

qqplayer

  • Sr. Member
  • ****
  • Posts: 282
    • View Profile
Re: [Plugin WIP] SavestateLoader (only for retroarch-windows)
« Reply #2 on: August 27, 2019, 07:24:02 AM »
I forgot to mention I've attached a beta version on the first post.
All seems to work fine.