flathub / com.fightcade.Fightcade

https://flathub.org/apps/details/com.fightcade.Fightcade
Apache License 2.0
10 stars 4 forks source link

Training mode not working #95

Closed luni3359 closed 2 years ago

luni3359 commented 2 years ago

Hey it's me again, this time I've been having issues with the training mode. When you open training mode (sfiii3nr1, ssf2xjr1, vsavj, probably all of them) you get an error window saying the following:

fbneo-training-mode.lua:390: Can't save config file

I thought that maybe the default training mode was broken so I tried drag-and-dropping the files on the data folder as detailed on vsavj's training mode link and it didn't seem to do anything either.

The broken training mode sorta works, but one limitation is that you have to wait for the pc's character pick time to run out for it to begin. The training dummy stays still but it's not invincible and when you win 2 rounds the game moves to the next battle and then the ai starts kicking in.

Pobega commented 2 years ago

Training mode isn't really expected to work; it's something I've been meaning to look into but haven't had the opportunity. It requires write access to additional files but I haven't been able to figure out if there's a consistency between them (does each game need different files or we have standardized on fbneo-training-mode.lua?) or if I'm always going to be chasing support for each game individually (not ideal/something I would want to pursue.)

I've asked people who've complained about training mode incompatibility in the past for implementation details but have never gotten any response and haven't looked into it since.

Do you know where the fbneo-training-mode.lua file is meant to be stored? If so I can whip up a quick test build you can try out.

luni3359 commented 2 years ago

By going to Game > Lua Scripting > New Lua Script Window... wine wants to find it under fbneo-training-mode/fbneo-training-mode.lua.

If I click on Browse it shows that it's seeing the following directories: Browsing the file picker

fbneo is inside the emulator directory Browsing the file picker again

Pobega commented 2 years ago

Does Fightcade download the Lua script there automatically?

Pobega commented 2 years ago

Check out https://github.com/flathub/com.fightcade.Fightcade/pull/96, I threw together something that might work.

The Flathub build bot should spit out an installable build, make sure that you remove all installations of the Fightcade Flatpak before seeing if this resolves the issue. In some cases a Testing version of the Fightcade frontend can still launch the Stable version of the emulators which would render any testing invalid.

Removing the Fightcade Flatpak shouldn't have any effect on your locally stored files (anything in ~/.var/app/com.fightcade.Fightcade should persist)

luni3359 commented 2 years ago

Does Fightcade download the Lua script there automatically?

It doesn't seem to be writing anything. I ran the command find ~/.var/app/com.fightcade.Fightcade/ -iname "*.lua" and the only lua files I see are the ones I moved from the training mode guide for vsavj.

lua files in terminal

Pobega commented 2 years ago

It doesn't seem to be writing anything

It shouldn't be writing anything, that directory is read-only. I was more asking if you knew what the intended behavior is on a normal Fightcade install.

luni3359 commented 2 years ago

I had a problem where running flatpak install --user https://dl.flathub.org/build-repo/96049/com.fightcade.Fightcade.flatpakref tried to overwrite the flathub remote. I chose no because I was afraid of borking my flatpak (although I'm 50% sure it's the default url).

Regardless, I tried it again and it didn't work and I got the following warning: Not exporting file com.fightcade.Fightcade.appdata.xml of unsupported type. I'm scared of messing something up.

luni3359 commented 2 years ago

In the end I ended up accepting and nothing seems to have broken. I'm still getting the same Not exporting file com.fightcade.Fightcade.appdata.xml of unsupported type. Is that normal?

Training mode isn't working. I tried one more time closing everything and resetting the custom permissions I set on Flatseal without success.

luni3359 commented 2 years ago

I have removed Fightcade in its entirety by running flatpak remove --unused and it got rid of these dependency flatpaks Terminal window

Now Fightcade doesn't start Terminal window error

I thought that the test build would get those dependencies by itself.

Pobega commented 2 years ago

No, the test build doesn't get those dependencies. It's an issue with how dependencies work on Flatpak test builds sadly, they can only be brought in as deps by the stable Flatpak.

luni3359 commented 2 years ago

I managed to put things as they were before but training mode is still not working. I doubt this is relevant but I got this on my terminal.

Pobega commented 2 years ago

So after speaking to pof I think this is going to require some more work. Essentially the training mode wants to be able to write to fbneo-training-mode/games/<game>/config.lua.

Normally I'd just symlink the directory/file out to a writable version, but the fact that there's a directory for each game makes it a little more annoying. Essentially we either have to copy out all of the data somewhere else, or symlink each config.lua individually in a loop somewhere (then also use a loop to create the writable files in the user's data dir.)

luni3359 commented 2 years ago

I'm not very knowledgeable on flatpaks but what some programs do is tuck in the whatever should go in ~/.local/share/ into ~/.var/app/<appname/data. I believe that this way they don't have to create symlinks for every folder. For example this is what dolphin looks like: Dolphin File manager Dolphin File manager

@TheEvilSkeleton Do you think you could help us? I noticed that you made a PR earlier so I thought you might be know about the subject. If you can ask around I'd appreciate it too.

Pobega commented 2 years ago

I don't think we need involvement from EvilSkeleton, that was just a general Flatpak related PR for an improvement that they're trying to make across multiple projects.

The work isn't impossible, the complication is that there is a disconnect between build time changes (symlinks in the read-only parts need to be made during build) and runtime (at runtime we have access to a user's data directory and can now make the writable files we created [dead] symlinks during build.) It's the same way we handle other files that require write access, it's just going to need a little bit more logic (since we can't just symlink the entire folder as it contains data that we need to preserve.)

Also keep in mind Fightcade is not open source - a lot of issues with Flatpaks can be fixed by submitting upstream patches to the project you're Flatpak'ing to be more Flatpak friendly, but that isn't the case here. In general we're stuck just working around issues, though if something is problematic enough pof has made Fightcade-side changes specifically for Flatpak in the past.

I can't give an ETA on this as I have work and life to attend to, but I will definitely take a look at some point.

Pobega commented 2 years ago

Implementation wise there are two solutions I can see.


Now the symlink that FBNeo sees as the fbneo-training-mode/ directory should be pointing at the /var/data/fbneo-training-mode r/w directory, and users can add/remove scripts as they please.

The downside here is that modifications to any files shipped in Fightcade would be overwritten on a fresh launch. A consideration as a workaround to this is to use cp --update which will only copy files if the source files are newer than the destination files, or if the destination files do not exist [1] which would allow user modifications to persist, and you can delete the file to get back the original (but this is non-standard behavior so probably completely unclear to end users.)


Iterate through all the subfolders in fbneo-training-mode/games/{game} and symlink fbneo-training-mode/games/{game}/config.lua to /var/data/fbneo-training-configs/{game}.lua. This is the simpler solution but doesn't allow user modifications to the training mode scripts themselves.


My gut feeling is that modifications to those scripts may not matter since if users want they can use any lua scripts they drop into their data directory by pointing FBNeo at the file in /var/data/, so I think the second solution is the least error-prone and most clear.

Let me know if you have any opinions on this as I don't use training mode on Fightcade games, so I don't know what users expect.

[1] http://beginnerlinuxtutorial.com/basic-linux-commands/cp-linux-copy-command/

Pobega commented 2 years ago

@luni3359 Could you try the build mentioned in https://github.com/flathub/com.fightcade.Fightcade/pull/97#issuecomment-1171811544 ?

Pobega commented 2 years ago

I tried it out on my system and the error is gone on vsavj, but it seems like you need to configure the controls for 2P to select a character. Not sure if this is intended behavior. But the errors seem to be gone!

Please let me know if this build works any better for you

luni3359 commented 2 years ago

Sorry for the delay, it works like a charm! I'm not sure what the default behavior is on windows, but the training does start once p2 times out for their selection, I'll have to try it out myself later.

I couldn't get the dedicated training mode for vsavj to work (this one) because it requires running a bat file within the data folder and I think that's out of scope for flatpak. That being said training mode worked on every other fbneo game I tried. Thank you so much!