Author Topic: Problems with the option "Record Input"  (Read 1353 times)

Offline Neildark

  • Newbies
  • *
  • Posts: 20
  • Karma: +1/-0
Problems with the option "Record Input"
« 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
« Last Edit: June 16, 2019, 08:49:59 PM by Neildark »

Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #1 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

Offline Neildark

  • Newbies
  • *
  • Posts: 20
  • Karma: +1/-0
Re: Problems with the option "Record Input"
« Reply #2 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.

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 434
  • Karma: +18/-1
  • Helper
Re: Problems with the option "Record Input"
« Reply #3 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

Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #4 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


Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #5 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

Offline Neildark

  • Newbies
  • *
  • Posts: 20
  • Karma: +1/-0
Re: Problems with the option "Record Input"
« Reply #6 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.

Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #7 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

Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #8 on: June 17, 2019, 11:33:22 AM »
Neildark, thanks for the info, I will hopefully have a fix soon!

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 434
  • Karma: +18/-1
  • Helper
Re: Problems with the option "Record Input"
« Reply #9 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.
« Last Edit: June 17, 2019, 01:14:36 PM by barbudreadmon »

Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #10 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

Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #11 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

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 434
  • Karma: +18/-1
  • Helper
Re: Problems with the option "Record Input"
« Reply #12 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.
« Last Edit: June 18, 2019, 05:00:41 AM by barbudreadmon »

Offline Neildark

  • Newbies
  • *
  • Posts: 20
  • Karma: +1/-0
Re: Problems with the option "Record Input"
« Reply #13 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!


Offline dink

  • Administrator
  • *****
  • Posts: 3166
  • Karma: +259/-0
  • side effects: new or worsening heart failure
Re: Problems with the option "Record Input"
« Reply #14 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