GCI Folder support for TAS Recording/Playback

This commit is contained in:
Chris Burgener 2016-12-18 19:10:01 -05:00
parent 7fa14169e9
commit 5193813b50
5 changed files with 49 additions and 17 deletions

View File

@ -344,6 +344,8 @@ bool BootCore(const std::string& _rFilename)
StringFromFormat("Movie%s.raw", (i == 0) ? "A" : "B")))
File::Delete(File::GetUserPath(D_GCUSER_IDX) +
StringFromFormat("Movie%s.raw", (i == 0) ? "A" : "B"));
if (File::Exists(File::GetUserPath(D_GCUSER_IDX) + "Movie"))
File::DeleteDirRecursively(File::GetUserPath(D_GCUSER_IDX) + "Movie");
}
}
}

View File

@ -33,6 +33,34 @@ static std::array<std::unique_ptr<CEXIChannel>, MAX_EXI_CHANNELS> g_Channels;
static void ChangeDeviceCallback(u64 userdata, s64 cyclesLate);
static void UpdateInterruptsCallback(u64 userdata, s64 cycles_late);
namespace
{
void AddMemoryCards(int i)
{
TEXIDevices memorycard_device;
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
{
if (Movie::IsUsingMemcard(i))
{
if (SConfig::GetInstance().m_EXIDevice[i] == EXIDEVICE_MEMORYCARDFOLDER)
memorycard_device = EXIDEVICE_MEMORYCARDFOLDER;
else
memorycard_device = EXIDEVICE_MEMORYCARD;
}
else
{
memorycard_device = EXIDEVICE_NONE;
}
}
else
{
memorycard_device = SConfig::GetInstance().m_EXIDevice[i];
}
g_Channels[i]->AddDevice(memorycard_device, 0);
}
} // namespace
void Init()
{
if (!g_SRAM_netplay_initialized)
@ -44,18 +72,9 @@ void Init()
for (u32 i = 0; i < MAX_EXI_CHANNELS; i++)
g_Channels[i] = std::make_unique<CEXIChannel>(i);
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
{
g_Channels[0]->AddDevice(Movie::IsUsingMemcard(0) ? EXIDEVICE_MEMORYCARD : EXIDEVICE_NONE,
0); // SlotA
g_Channels[1]->AddDevice(Movie::IsUsingMemcard(1) ? EXIDEVICE_MEMORYCARD : EXIDEVICE_NONE,
0); // SlotB
}
else
{
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
g_Channels[1]->AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0); // SlotB
}
for (int i = 0; i < MAX_MEMORYCARD_SLOTS; i++)
AddMemoryCards(i);
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);

View File

@ -21,6 +21,7 @@ class Mapping;
enum
{
MAX_MEMORYCARD_SLOTS = 2,
MAX_EXI_CHANNELS = 3
};

View File

@ -163,8 +163,13 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
const bool shift_jis = region == DiscIO::Region::NTSC_J;
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX) +
SConfig::GetDirectoryForRegion(region) + DIR_SEP +
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsUsingMemcard(card_index) &&
Movie::IsStartingFromClearSave())
strDirectoryName += "Movie" DIR_SEP;
strDirectoryName = strDirectoryName + SConfig::GetDirectoryForRegion(region) + DIR_SEP +
StringFromFormat("Card %c", 'A' + card_index);
if (!File::Exists(strDirectoryName)) // first use of memcard folder, migrate automatically

View File

@ -465,6 +465,7 @@ bool IsUsingMemcard(int memcard)
{
return (s_memcards & (1 << memcard)) != 0;
}
bool IsSyncGPU()
{
return s_bSyncGPU;
@ -1486,8 +1487,12 @@ void GetSettings()
s_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
s_language = SConfig::GetInstance().SelectedLanguage;
}
s_memcards |= (SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD) << 0;
s_memcards |= (SConfig::GetInstance().m_EXIDevice[1] == EXIDEVICE_MEMORYCARD) << 1;
s_memcards |= (SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD ||
SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARDFOLDER)
<< 0;
s_memcards |= (SConfig::GetInstance().m_EXIDevice[1] == EXIDEVICE_MEMORYCARD ||
SConfig::GetInstance().m_EXIDevice[1] == EXIDEVICE_MEMORYCARDFOLDER)
<< 1;
std::array<u8, 20> revision = ConvertGitRevisionToBytes(scm_rev_git_str);
std::copy(std::begin(revision), std::end(revision), std::begin(s_revision));