Welcome!

Final Burn Neo => FBN Discussion => Topic started by: Neildark on June 16, 2019, 08:46:15 PM

Title: Problems with the option "Record Input"
Post by: Neildark on June 16, 2019, 08:46:15 PM
Hello everyone, I have a problem with the option "Record Input", I wanted to record several games to Neo Geo CD games (Fatal Fury Special for example) taking advantage of the macros, but after recording several gameplay when I give the option to "replay" input "to record it on video, although the file indicates 40 minutes of recording, 150,000 Frames, Undo Count 3, the game starts correctly but at some point the character does not execute the correct movements or remains stopped and Game Over appears, sometimes even in the first round. At the loading points I gave the F1 (FFWD) to go faster, and I usually save state in some initial fights so as not to lose the advance of the game (I noticed that it slows down a second and a half each time I give Save State button), ?would this have anything to do with it, or is it not well implemented in the Neo Geo CD?
When I used this option in Neo Geo MVS or Capcom games I do not usually have problems, but now I can not save a complete game without errors.

Any advice or help is welcome. Thanks everyone 😉

PD:
I am using the latest compiled version of this page: http://ashura.mameworld.info/nightlybuilds/builds.html
Title: Re: Problems with the option "Record Input"
Post by: dink on June 16, 2019, 09:23:16 PM
Hi Neildark,
I think the NeoCD emulation might have issues with recording, some tests will have to be done, then I can try to make a fix for the issue - stay tuned :)

States loading and saving should be fine while recording, but this doesn't work with all systems - I try to fix them as soon as I realize there is a problem somewhere. 

Can you tell me, do the macro buttons & recording with regular NeoGeo playback fine?

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: Neildark on June 17, 2019, 04:13:04 AM
First of all thanks for the quick response.
I use Final Burn Neo mainly to record TAS (Tool-assisted superplay) gameplays, which means that sometimes I save and charge save-states several times so I can then record a perfect gameplay on video and upload it to YouTube. In the games of regular Neo Geo also sometimes fails, I could say that of 10 games I record 3 fail, I do not know exactly what causes it, there are games where I just use save-states to repeat zones and yet it fails, and there other times I repeat more than fifteen times, I use the Pause, FFWD, change options, macros, and everything works correctly. I have not noticed that it has to do with the duration of the video, I have recorded long gameplays to Samurai Shodown 2 (45 minutes) that have failed, and other short Fatal Fury Real Bout 2 (18 minutes) and fail the same.
The fault usually is that either during the game there is a moment in which the character stops moving, or gives the impression that his recorded movements have been desynchronized and that causes the end of the game, it may be right at the beginning, in medium, or in the end, I have not found a concrete routine either.
With the games of Capcom (Street Fighter for example) has also happened to me sometimes, but there I have not done so many tests.
Macro buttons in Neo Geo work well, even if you change them during the game.

I hope you can find the problem and solve it, I would save a lot of time ha ha ha :biggrin: :biggrin:. Thanks for all. Greetings.
Title: Re: Problems with the option "Record Input"
Post by: barbudreadmon on June 17, 2019, 05:01:56 AM
@dink there might be some weirdness with ngcd's savestates, that's what i get when turning on readahead and starting a game (FF Special) in the libretro port :
Code: [Select]
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
AddressSanitizer:DEADLYSIGNAL
=================================================================
==28073==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fbebec9213f bp 0x000000000000 sp 0x7ffe29a9f670 T0)
==28073==The signal is caused by a READ memory access.
==28073==Hint: address points to the zero page.
    #0 0x7fbebec9213e in NeoUpdateSprites(int, int) ../../burn/drv/neogeo/neo_sprite.cpp:128
    #1 0x7fbebeb94280 in NeoScan(int, int*) ../../burn/drv/neogeo/neo_run.cpp:1574
    #2 0x7fbebe308b33 in BurnAreaScan ../../burn/burn.cpp:879
    #3 0x7fbebfbd49f9 in retro_unserialize ../../burner/libretro/libretro.cpp:988
    #4 0x563ef83cf8f7  (/usr/bin/retroarch+0xd88f7)
    #5 0x563ef835d0f1  (/usr/bin/retroarch+0x660f1)
    #6 0x563ef83569ff  (/usr/bin/retroarch+0x5f9ff)
    #7 0x7fbecbbe6efa in __libc_start_main (/lib64/libc.so.6+0x23efa)
    #8 0x563ef8353959  (/usr/bin/retroarch+0x5c959)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../../burn/drv/neogeo/neo_sprite.cpp:128 in NeoUpdateSprites(int, int)
==28073==ABORTING
Title: Re: Problems with the option "Record Input"
Post by: dink on June 17, 2019, 07:52:39 AM
Neildark, thanks for the info.  The more complex a system is, the harder it is to keep things in synch with the recording function.  Sometimes a system has a built in clock (like the neo-geo's upd4990), and it derives the pseudo-random info from the time it gets from that, and that makes recording almost impossible.  Though some machines set the random number info based on user entropy (the time that passes between movement & button presses, etc).  FBA of course has no problem with that kind.

One thing comes to mind - PGM (PolyGameMaster) initializes the random number generator @ boot, so if you start recording after the game has booted - and not use "record from Power On" it will have no problem.  So, with that in mind, could you try doing a record in NeoCD game that way just to see if it works?  This info will help me find the problem of course.

best regards,
- dink

Title: Re: Problems with the option "Record Input"
Post by: dink on June 17, 2019, 07:55:11 AM
Barbudredmon, thanks for the info - that error will only happen if a state is taken during a dma transfer (during cd load - they're very short bursts, so its hard to get a state in that mode), I just made provisions to prevent a problem from happening in that case, though. :)  I have to test it later today before commiting - though.

The ZetTotalCycles warning is not a problem, by any means, and can be ignored :)

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: Neildark on June 17, 2019, 08:42:33 AM
Hello, Dink.

All the recordings I make are always from a specific point, in Neo Geo just when the Neo-Geo logo appears (so as not to record the green static images of the beginning), and with Neo Geo CD the three times I tried to record , I've done it on the title screen (when it gives you a choice between Game Start Demo Game How To Play). I have also tried saving Save States at the beginning of the round and never doing it during the loading screen.
I just did a test with another game (The King of fighers 94) and the same thing happens, I've started recording from the title screen, and the recording has been desynchronized to the minute.
I hope you find the problem. Thanks for everything and sorry for my bad English.
Title: Re: Problems with the option "Record Input"
Post by: dink on June 17, 2019, 11:26:59 AM
barbudreadmon, Please try again w/latest git

@dink there might be some weirdness with ngcd's savestates, that's what i get when turning on readahead and starting a game (FF Special) in the libretro port :
Code: [Select]
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
[libretro ERROR] ZetTotalCycles called when no CPU open
AddressSanitizer:DEADLYSIGNAL
=================================================================
==28073==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fbebec9213f bp 0x000000000000 sp 0x7ffe29a9f670 T0)
==28073==The signal is caused by a READ memory access.
==28073==Hint: address points to the zero page.
    #0 0x7fbebec9213e in NeoUpdateSprites(int, int) ../../burn/drv/neogeo/neo_sprite.cpp:128
    #1 0x7fbebeb94280 in NeoScan(int, int*) ../../burn/drv/neogeo/neo_run.cpp:1574
    #2 0x7fbebe308b33 in BurnAreaScan ../../burn/burn.cpp:879
    #3 0x7fbebfbd49f9 in retro_unserialize ../../burner/libretro/libretro.cpp:988
    #4 0x563ef83cf8f7  (/usr/bin/retroarch+0xd88f7)
    #5 0x563ef835d0f1  (/usr/bin/retroarch+0x660f1)
    #6 0x563ef83569ff  (/usr/bin/retroarch+0x5f9ff)
    #7 0x7fbecbbe6efa in __libc_start_main (/lib64/libc.so.6+0x23efa)
    #8 0x563ef8353959  (/usr/bin/retroarch+0x5c959)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../../burn/drv/neogeo/neo_sprite.cpp:128 in NeoUpdateSprites(int, int)
==28073==ABORTING
Title: Re: Problems with the option "Record Input"
Post by: dink on June 17, 2019, 11:33:22 AM
Neildark, thanks for the info, I will hopefully have a fix soon!
Title: Re: Problems with the option "Record Input"
Post by: barbudreadmon on June 17, 2019, 11:54:40 AM
@dink the first crash disappeared, now it's crashing at the end of the ngcd bios :
Code: [Select]
AddressSanitizer:DEADLYSIGNAL
=================================================================
==24657==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f5e34f0d0e8 bp 0x000000000096 sp 0x7ffda9738e00 T0)
==24657==The signal is caused by a READ memory access.
==24657==Hint: address points to the zero page.
    #0 0x7f5e34f0d0e7 in _IO_ftell (/lib64/libc.so.6+0x740e7)
    #1 0x7f5e28ee4d96 in cdimgLoadSector ../../burner/libretro/retro_cdemu.cpp:661
    #2 0x7f5e28ee4d96 in CDEmuLoadSector(int, char*) ../../burner/libretro/retro_cdemu.cpp:1053
    #3 0x7f5e27e8870e in NeoCDReadSector ../../burn/drv/neogeo/neo_run.cpp:3147
    #4 0x7f5e27e8870e in NeoSekRun ../../burn/drv/neogeo/neo_run.cpp:4486
    #5 0x7f5e27e98583 in NeoFrame() ../../burn/drv/neogeo/neo_run.cpp:4893
    #6 0x7f5e27608479 in BurnDrvFrame ../../burn/burn.cpp:746
    #7 0x7f5e28ed3b18 in ForceFrameStep ../../burner/libretro/libretro.cpp:452
    #8 0x7f5e28ed5f49 in retro_run ../../burner/libretro/libretro.cpp:864
    #9 0x55cc3c9adc98  (/usr/bin/retroarch+0x60c98)
    #10 0x55cc3ca2578e  (/usr/bin/retroarch+0xd878e)
    #11 0x55cc3c9b30f1  (/usr/bin/retroarch+0x660f1)
    #12 0x55cc3c9ac9ff  (/usr/bin/retroarch+0x5f9ff)
    #13 0x7f5e34ebcefa in __libc_start_main (/lib64/libc.so.6+0x23efa)
    #14 0x55cc3c9a9959  (/usr/bin/retroarch+0x5c959)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib64/libc.so.6+0x740e7) in _IO_ftell
==24657==ABORTING

the libretro cdimgLoadSector function is almost a 1:1 copy of the one at src/intf/cd/win32/cd_img.cpp (the only diff is that i use fopen instead of _wfopen), it seems to be crashing on this line specifically :
Code: [Select]
cdimgLBA = cdimgMSFToLBA(cdimgTOC->TrackData[0].Address) + (ftell(cdimgFile) + 2351) / 2352 - cd_pregap;

Edit : this crash happens because cdimgFile is NULL

Edit2 : FWIW, i tried logging LBA & cdimgLBA values when the function is called :
Code: [Select]
LBA : 164 - cdimgLBA : 1
LBA : 164 - cdimgLBA : 15
LBA : 164 - cdimgLBA : 1
LBA : 164 - cdimgLBA : 15
LBA : 15 - cdimgLBA : 15
LBA : 16 - cdimgLBA : 16
LBA : 17 - cdimgLBA : 17
LBA : 164 - cdimgLBA : 15
LBA : 15 - cdimgLBA : 15
LBA : 16 - cdimgLBA : 16
LBA : 17 - cdimgLBA : 17
LBA : 18 - cdimgLBA : 18
LBA : 19 - cdimgLBA : 19
LBA : 20 - cdimgLBA : 20
LBA : 168 - cdimgLBA : 21
LBA : 18 - cdimgLBA : 18
Then the crash happens, the values doesn't seem to be game-dependent.
Title: Re: Problems with the option "Record Input"
Post by: dink on June 17, 2019, 11:13:12 PM
barbudreadmon, move this block (below) above the "if (LBA != cdImgLBA) {" line:
Code: [Select]
if (cdimgFile == NULL)
{
cdimgStop();

cdimgFile = fopen(cdimgTOC->Image, _T("rb"));
if (cdimgFile == NULL)
return 0;
}

it might help :)

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: dink on June 18, 2019, 12:37:42 AM
Neildark, I made a test/fix for this problem.
I recorded a game (from the character selection screen), and played against terry and chonrei, and
it kept my inputs synchronized for 4 fights.  (I didn't try any longer).

BUT: sometimes the first time playing back the inputs, it will desynchronize :(  try playback again, and it works.  Very complex systems are hard to keep synchronized...  I'll try to fix more tomorrow!  :)

here's my test-exe: https://www.sendspace.com/file/qbqxsn

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: barbudreadmon on June 18, 2019, 02:15:07 AM
@dink that's something i already tried, it hangs for some time then it goes to cd player with this solution.
The furthest i can go (the screen with the loading bar) is by commenting cdimgCloseFile in cdimgScan, however the ngcd throws me a "disc i/o error" a bit later.
Title: Re: Problems with the option "Record Input"
Post by: Neildark on June 18, 2019, 04:57:52 AM
Hello, Dink. I've tried the new Exe. I recorded a 35-minute gaming at the Fatal Fury Special. When I wanted to reproduce it was out of synch in the first fight, I tried again a couple of times and it was the same. However, it occurred to me to enter the Cd Player menu, play a couple of songs and then replay input. That was all good, until the 18th minute, ninth bout, in which it has returned to desynchronize  :redface: :redface:

Thanks for your effort in trying to solve it, Greetings!

Title: Re: Problems with the option "Record Input"
Post by: dink on June 18, 2019, 07:44:57 AM
Neildark, this is going to be a hard one, due to complexities of the system.  I'll keep trying, though!

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: dink on June 21, 2019, 12:00:47 AM
Neildark,
I've made some progress - now it will play back my 4-fight recording perfectly every time.  During this recording, I made about 100 state save/loads :)
But, it will be a day until I have an exe ready, quite a bit of cleanup is needed after this mega-debug bout.  :p

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: Neildark on June 21, 2019, 02:51:17 AM
Thank you very much for your effort Dink, it is impressive what you get involved every time we make a suggestion or comment on a bug. As soon as you have the exe I will also do several tests with long gameplay to verify that everything is fine, Thanks again! :biggrin: :biggrin:
Title: Re: Problems with the option "Record Input"
Post by: dink on June 22, 2019, 08:07:06 PM
Hi Neildark, thanks for the nice words :)
Here's some update info:
Last time I posted, I was able to get the game to survive 4 fights w/2 diff. characters, but it would still desynch later on after lots of disc activity.  This is an improvement, but I am still not happy with this.

After another day of experimenting: Now I am able to get a neogeo cd recording to survive from "power on"! :) 

But there still is work left to do, I will continue to post updates here for now.

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: dink on June 23, 2019, 10:07:32 AM
Here's a new test exe: https://www.sendspace.com/file/vtapsu

Here's my RBFFS recording: https://www.sendspace.com/file/j5hnet

I recorded a (about)12 minute game of Real Bout fatal furyspecial, using almost 280 save/loads states, and exited emulator / restarted and continued recording for each fight.  it plays it back fine now :)
I also tested 5 minutes of double dragon with the same methods, no problems here!

I also like to know, does my RBFFS recording play back fine on your computer with the new testexe ?

something you'll notice: while loading, the game has small delays.  This can't be avoided, it's the game waiting for the laser of the cdrom drive to move to correct position.  Previously I went around this, but emulating it correctly is necessary for recordings.

Please give it a try,

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: Neildark on June 23, 2019, 08:24:06 PM
Thank you very much Dink, tomorrow I'll get to it, I'll try your Save State and I'll do tests with long Gameplays, with the conclusions I'll confirm something as soon as possible, Greetings!
Title: Re: Problems with the option "Record Input"
Post by: dink on June 24, 2019, 12:36:07 AM
Neildark, I'm eager to know how it works for you!   A lot of work went into this one. (more than 12 hours)

Just wanted to say, *against my better judgement* I played a full game of Aero Fighters 3 NeoGeo CD while recording tonight, and it played back the entire recording (from boot) perfectly.

This is from the ending. no kidding :)  Only click this link if:
1: you don't mind weird stuff
2: don't mind to see the a part from the ending of aero fighters 3/sonic wings 3 "neogeocd" version
https://i.postimg.cc/c4rvGcYx/aerof3-ha.png
to give it context: the story is "the doctor gave the robot a human body, but left on his powerup weapon"....
Title: Re: Problems with the option "Record Input"
Post by: dink on June 24, 2019, 09:34:11 AM
The problem gets more interesting...
Seems like only Enhanced Blitter is capable of playback without desyncs.  Now it's time to fix the other blitters (Basic, DX9 etc)

best regards,
- dink
Title: Re: Problems with the option "Record Input"
Post by: el_rika on June 26, 2019, 10:15:00 AM
Quiick question for the powers that be :)

Is it possible to add recording/replay option to the android core? Thanks!
Title: Re: Problems with the option "Record Input"
Post by: barbudreadmon on June 26, 2019, 11:19:52 AM
Is it possible to add recording/replay option to the android core? Thanks!

You mean with retroarch ? It doesn't seem to have those features.
Title: Re: Problems with the option "Record Input"
Post by: el_rika on June 26, 2019, 12:43:50 PM
You mean with retroarch ? It doesn't seem to have those features.

Yes, i was referring to Retroarch. So it means that the devs at libreto should implement it then?
Title: Re: Problems with the option "Record Input"
Post by: barbudreadmon on June 26, 2019, 01:11:01 PM
Yes, i was referring to Retroarch. So it means that the devs at libreto should implement it then?

My bad, actually it does exist, but not from the UI, only from command line :
- "--bsvrecord yourfile.bsv" => record
- "--bsvplay yourfile.bsv" => play
Title: Re: Problems with the option "Record Input"
Post by: dink on June 26, 2019, 11:43:10 PM
neogeo cd recording tweaks
test3 exe, https://www.sendspace.com/file/ug4tcb
Title: Re: Problems with the option "Record Input"
Post by: el_rika on June 27, 2019, 02:49:23 AM
My bad, actually it does exist, but not from the UI, only from command line :
- "--bsvrecord yourfile.bsv" => record
- "--bsvplay yourfile.bsv" => play

Am i able to activate this in android?
Title: Re: Problems with the option "Record Input"
Post by: barbudreadmon on June 27, 2019, 05:24:02 AM
Am i able to activate this in android?
I don't think you can activate them without using command line.
Title: Re: Problems with the option "Record Input"
Post by: el_rika on June 27, 2019, 11:17:21 PM
I don't think you can activate them without using command line.

Thanks!   :smilie: