DragonMinded / bemaniutils

A collection of utilities which together make up a hobby game services network and associated utilities for historic games in the BEMANI series.
The Unlicense
209 stars 65 forks source link

(afputils) SDVX Hexa Diver Bg render problem #82

Open dannylin0711 opened 8 months ago

dannylin0711 commented 8 months ago

As title, was rendering hexa diver game bg, and parseafp shows that the bg loops at 120 frame but looking in the video or playing the game doesn't seem to be loop at that frame, using list shows that there should be total 680 frames. Is this a parsing issue?

DragonMinded commented 8 months ago

The repeat behavior is part of the bytecode engine. There is no actual repeat in the file format, but bytecode can ask to move to a frame, and afputils attempts to recognize loops by seeing if something seeks backwards. I'm sure it's not perfect, the format turns out to have gone through enough changes that a single unified engine isn't really possible. I've considered adding quirks modes but testing for that would quickly get out of hand. Not sure what a solution is in general, just thinking out loud.

dannylin0711 commented 8 months ago

Maybe adding a flag that tries to ignore the loop for now? Not sure if it's possible though, since not really familiar with afp file format.

dannylin0711 commented 8 months ago

I might found where the problem is, the bytecode attempt to only rewind the center ball in the background, but afputils rewinds the whole afp which causes this problem.

DragonMinded commented 8 months ago

Oh, interesting, there might be a bug in the root object that the bytecode is pointing to.

dannylin0711 commented 8 months ago

If I skip the gotoAndPlay method call, which skips the loop, the clip keeps render but without the center ball.

dannylin0711 commented 7 months ago

bg_top.txt So this is the decompiled code that afptuils generated, seems like multiple loop is in the afp.

DragonMinded commented 7 months ago
on_enter_main_frame_120()
{
    aeplib.gotoAndPlay(THIS, 'loop');
}

This would imply that the looping at frame 120 is correct, no? Not sure what's going on in there.

dannylin0711 commented 7 months ago
on_enter_sprite_110_frame_901()
{
    aeplib.gotoAndPlay(THIS, 'loop');
}

But some subsprites go over 120 frames, so looping at 120 may deliver incorrect result?

dannylin0711 commented 6 months ago

Also, the subclip in the root clip seems to loop at a frame no. larger than root clip. Instead rewinding the whole root clip, maybe rewind each subclip by their own?

btw just curious, instead of using PIL, will using something like opencv2 that uses GPU be faster?