I ended up using an Autohotkey script running in the background that will trigger a save state at a certain amount of time.
The script checks to see if there is an activity from the controls so that it doesn't save during play and then if there isn't any detected in 30 seconds, it will trigger a save state in mame. It will then wait 10 minutes until it checks again so that it doesn't keep saving continuously if nobody is playing the machine.
So I figure once I'm done playing, i just have to wait about 30 seconds before I turn off the machine so that it'll save state. Then on the next boot up, it will load the save state.
#InstallKeybdHook
#InstallMouseHook
#Persistent
Loop
{
WinActivate Mame64
if A_TimeIdle >= 30000 ; Is there 30 seconds of idle time?
{
Sleep, 30
Send, {Shift Down}
Send, {F7 Down}
Sleep, 30
Send, {Shift up}
Send, {F7 up}
Sleep, 30
Send, {1 Down}
Sleep, 30
Send, {1 Up}
Sleep, 30
Sleep 600000 ; If there is idle time it saves and then it waits 10 minutes until it checks again
}
In the mame.ini I changed the following:
state 1
keyboardprovider dinput