Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy Wii save for current game for Netplay and TAS #4546

Merged
merged 1 commit into from Feb 8, 2017

Conversation

RisingFog
Copy link
Member

This brings back functionality prior to the "Blank NAND" to use saves in Netplay and TASes.

I would like some testing and comments on if this is the proper way to go about this.

@RisingFog RisingFog force-pushed the tas_wii_nand branch 3 times, most recently from 63bf6e6 to 6ccecda Compare December 24, 2016 02:47
@JMC47
Copy link
Contributor

JMC47 commented Dec 24, 2016

I was able to sync up with saves. Have not tested writing + reloading though.

We need an option to disable this in the Netplay Window for smash users though.

@JMC47
Copy link
Contributor

JMC47 commented Dec 24, 2016

@E2xD Can you get netplay people to test this out? Should allow loading Wii saves in netplay; assuming both players have the save. I don't know if it's useful for smash (in fact, it's probably detrimental) but it'l be important for other games. And we have to make sure we don't break Brawl netplay in the process.

{
// TODO: Check for the actual save data
if (File::Exists(user_save_path + "banner.bin"))
SetClearSave(false);

This comment was marked as off-topic.

This comment was marked as off-topic.


void ShutdownWiiRoot()
{
if (!s_temp_wii_root.empty())

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -54,6 +56,21 @@ void ShutdownWiiRoot()
{
if (!s_temp_wii_root.empty())
{
u64 tmd_title_id = Movie::GetTitleId();

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

// Backup the existing save just in case it's still needed.
if (File::Exists(user_save_path + "banner.bin"))
{
File::CopyDir(user_save_path, user_save_path + "../backup/");

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@JosJuice
Copy link
Member

Why is the second commit an improvement? The temporary NAND handling isn't only used for movies, it's used for netplay too.

@RisingFog
Copy link
Member Author

@JosJuice It's an improvement because GCC had linking issues when trying to use GetTitleId() from within NandPaths in the first commit, and it was the best place I could think of putting it to resolve the issues.

@RisingFog RisingFog changed the title [RFC/WIP] Copy Wii save for current game for Netplay and TAS Copy Wii save for current game for Netplay and TAS Dec 28, 2016
@JMC47
Copy link
Contributor

JMC47 commented Jan 8, 2017

This pull request works perfectly. Tested with Dokapon Kingdom across 2 days and 3 sessions so far.

We probably need to have a way to let the Brawl players avoid using this though...

@JosJuice
Copy link
Member

JosJuice commented Jan 8, 2017

Instead of putting code in Movie.cpp that doesn't fit there, could you put it in the new WiiRoot.cpp file created by PR #4621? (I suppose this means you would need to wait for that PR, though)

@JosJuice
Copy link
Member

JosJuice commented Jan 8, 2017

I've attempted to improve the title ID handling that I commented about earlier: PR #4629

if (IsRecordingInput())
{
// TODO: Check for the actual save data
SetClearSave(File::Exists(user_save_path + "banner.bin"));

This comment was marked as off-topic.

This comment was marked as off-topic.

SetClearSave(File::Exists(user_save_path + "banner.bin"));
}

if (Core::g_want_determinism && !IsStartingFromClearSave())

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@JMC47
Copy link
Contributor

JMC47 commented Jan 10, 2017

Considering netplay users usually stay behind a bit. I think we can merge this and someone else do save syncing so that there aren't more confusing options.

@Helios747 @leoetlino @JosJuice @mimimi085181 is that a reasonable solution?

Copy link
Member

@JosJuice JosJuice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JMC47 Sure, but we shouldn't merge this before the problems I pointed out are fixed. (IsStartingFromClearSave being expected to be correct when Movie isn't active, Movie.cpp containing code that should be somewhere else, maybe the title ID mess too (though it could be argued that all the title ID problems existed before this PR and can be fixed later by PR #4629))

@JosJuice
Copy link
Member

I did some more thinking about the /backup/ folder stuff, and I realized that this PR makes it more problematic. Before, /backup/ used to get deleted on the next non-Movie run, but now it seems like it will stay there forever unless the user manually goes poking around in the NAND. Do we really want that?

And do we actually need a /backup/ folder at all? It seems like the previous code just used it as a place to keep the "actual" save while running a movie, but we don't need that anymore since we have two entirely separate NANDs now. Though I suppose the user might not want to overwrite their actual save with one from a TAS... And we can't just hardcode it to not keep the save from a deterministic session, because people generally do want to keep their saves from netplay. It seems like a tricky situation.

@E2xD
Copy link
Contributor

E2xD commented Jan 18, 2017

I'm sorry. Ive been away from the dolphin netplay scene for some time (Life/Holidays/Work/Etc). Just to make sure I am clear, you want to add NAND syncing at the risk of compromising netplayers? Why not make it a selectable option under Config > Wii? Like have a toggle saying "Blank NAND" or something. Just my 2 cents.

@JosJuice
Copy link
Member

This commit does not add NAND syncing. In other words, no NAND files will be send over the network to other players. What it does do is copy the save files for the current game from the user's real NAND to the empty temporary NAND. I suppose SSBB/PM players don't want that since they want to have no save files when using netplay, right?

@E2xD
Copy link
Contributor

E2xD commented Jan 18, 2017

Correct.

@JMC47
Copy link
Contributor

JMC47 commented Jan 18, 2017 via email

@RisingFog RisingFog force-pushed the tas_wii_nand branch 2 times, most recently from ef97f71 to b22cbd1 Compare January 18, 2017 14:57

static std::string s_temp_wii_root;

void InitializeWiiRoot(bool use_dummy)

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -1580,4 +1580,77 @@ void Shutdown()
tmpInput = nullptr;
tmpInputAllocated = 0;
}

void CheckWiiSaves()

This comment was marked as off-topic.

This comment was marked as off-topic.

@RisingFog RisingFog force-pushed the tas_wii_nand branch 4 times, most recently from 4b2ccde to 6454e88 Compare January 18, 2017 16:19
@RisingFog RisingFog force-pushed the tas_wii_nand branch 3 times, most recently from 5623b0b to ad8f8c8 Compare January 18, 2017 16:41
@JosJuice JosJuice dismissed their stale review January 18, 2017 16:42

The issues I commented on earlier are (mostly) fixed

@JosJuice
Copy link
Member

JosJuice commented Jan 18, 2017

Only two of my comments are relevant anymore, and I'm not sure if they should block this PR from being merged or not. If others think it's fine to merge the affected parts as-is, you have my LGTM. The two potential blockers are:

  • Should we really pollute the NAND with backup folders? EDIT: The PR doesn't put things like that in the NAND anymore. It still puts them somewhere, and I'm not completely sure if that's the best way to go, but I don't consider this to be a blocker.
  • The pre-existing title ID handling is terrible, but it's improved by PR Don't call Movie::SetTitleId from ES #4629. I was thinking that we should clean it up (by merging PR Don't call Movie::SetTitleId from ES #4629) before merging this code that really makes use of Movie::GetTitleId, but I guess it could be fine to just merge that other PR later. EDIT: PR Don't call Movie::SetTitleId from ES #4629 has been merged.

@JosJuice
Copy link
Member

JosJuice commented Jan 18, 2017

Sorry, there's another problem: The commit history is messy. Various fixups have been applied to the last commit, and I don't think all of them belong in that commit. In particular, most of the second commit gets reverted by the last commit (instead of simply not being commited to begin with). Also, the first commit probably shouldn't mark RootUserPath as static (it's reverted later).

EDIT: All the commits have been squashed.

@RisingFog RisingFog force-pushed the tas_wii_nand branch 6 times, most recently from 06f153e to 501e35a Compare January 19, 2017 16:49
Common::GetTitleDataPath(Movie::GetTitleId(), Common::FROM_CONFIGURED_ROOT);
std::string user_backup_path =
File::GetUserPath(D_BACKUP_IDX) +
StringFromFormat("%08x/%08x/", (u32)(Movie::GetTitleId() >> 32), (u32)Movie::GetTitleId());

This comment was marked as off-topic.

This comment was marked as off-topic.

Common::GetTitleDataPath(Movie::GetTitleId(), Common::FROM_SESSION_ROOT);
std::string user_save_path =
Common::GetTitleDataPath(Movie::GetTitleId(), Common::FROM_CONFIGURED_ROOT);
std::string user_backup_path =

This comment was marked as off-topic.

File::DeleteDirRecursively(save_path + "../backup/");
#endif
}
Core::InitializeWiiSaves();

This comment was marked as off-topic.

This comment was marked as off-topic.

@RisingFog RisingFog force-pushed the tas_wii_nand branch 3 times, most recently from dea1031 to dd449a8 Compare January 29, 2017 22:56
@JMC47
Copy link
Contributor

JMC47 commented Feb 5, 2017

LGTM. Tested and verified that it loads the save, we can save in-game and load it later in another session and everything is working.

@JMC47
Copy link
Contributor

JMC47 commented Feb 8, 2017

Is there anything blocking this for merge?

@Parlane Parlane merged commit f838d16 into dolphin-emu:master Feb 8, 2017
@RisingFog RisingFog deleted the tas_wii_nand branch February 8, 2017 18:59
@MrManslayerX
Copy link

MrManslayerX commented Jun 9, 2017

@JMC47 Hey, I just got this set up, and it's giving me a Frame 18 desync for Dakapon Kingdom. Any advice? I had the game working on 2 different Dolphin builds.
One was from this thread: https://www.reddit.com/r/gamegrumps/comments/28d7wj/kinda_tutorial_on_how_to_play_dokapon_with_your/
This one would desync mid play.
Another was https://dolphin-emu.org/download/dev/d3894a05949c938295ca1587cf9d777a50ca9c60/
This one worked flawlessly, but I couldn't save on netplay.
This one just doesn't even get past Frame 18.
I'm playing with one other friend, and I'm using a controller with port 1 and wiimote 1 assigned to me, she was using her keyboard with wiimote 2 set. It was working just fine on the other two builds. But, we kinda need it to stay synced, AND be able to play. Hah.
I've done several hours of looking around on the dolphin forums and manual troubleshooting, but nothing's coming to fruition here on this version.

@JMC47
Copy link
Contributor

JMC47 commented Jun 9, 2017

We can narrow this down a bit. If you unplug the Wii Remotes and use GC controllers only, does the desync occur? If you uncheck use savefile, does the desync occur?

If you can find the results of these two things, we can narrow down what's tripping you up really easy. This isn't exactly the right place to discuss it, if you could ping me on freenode on #dolphin-emu, that's probably where I can give the best assistance.

@JosJuice
Copy link
Member

JosJuice commented Jun 9, 2017

Yeah, please don't discuss this on here. We use GitHub for development, not support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants