Some memory card fixes, CToken assign fix

This commit is contained in:
Jack Andersen 2017-02-02 20:23:09 -10:00
parent 75324e2ba6
commit e30ec98b6e
7 changed files with 41 additions and 7 deletions

View File

@ -358,6 +358,7 @@ kabufuda::ProbeResults CMemoryCardSys::CardProbe(kabufuda::ECardSlot port)
ECardResult CMemoryCardSys::MountCard(kabufuda::ECardSlot port)
{
kabufuda::Card& card = g_CardStates[int(port)];
card.commit();
card = kabufuda::Card(g_CardImagePaths[int(port)], "GM8E", "01");
ECardResult result = card.getError();
g_OpResults[int(port)] = result;

View File

@ -127,8 +127,6 @@ IObj* CToken::GetObj()
}
CToken& CToken::operator=(const CToken& other)
{
Unlock();
RemoveRef();
x0_objRef = other.x0_objRef;
if (x0_objRef)
{

View File

@ -166,10 +166,27 @@ class TLockedToken : public TCachedToken<T>
public:
TLockedToken() = default;
TLockedToken(const TLockedToken& other) : TCachedToken<T>(other) { CToken::Lock(); }
TLockedToken& operator=(const TLockedToken& other) { TCachedToken<T>::operator=(other); CToken::Lock(); return *this; }
TLockedToken& operator=(const TLockedToken& other)
{
CToken oldTok = std::move(*this);
TCachedToken<T>::operator=(other);
CToken::Lock();
return *this;
}
TLockedToken(const CToken& other) : TCachedToken<T>(other) { CToken::Lock(); }
TLockedToken& operator=(const CToken& other) { TCachedToken<T>::operator=(other); CToken::Lock(); return *this; }
TLockedToken(CToken&& other) : TCachedToken<T>(std::move(other)) { CToken::Lock(); }
TLockedToken& operator=(const CToken& other)
{
CToken oldTok = std::move(*this);
TCachedToken<T>::operator=(other);
CToken::Lock();
return *this;
}
TLockedToken(CToken&& other)
{
CToken oldTok = std::move(*this);
*this = TCachedToken<T>(std::move(other));
CToken::Lock();
}
};
}

View File

@ -819,6 +819,11 @@ CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::ProcessUserInput(const CFinalInpu
SetUIText(EUIType::LinkFailed);
}
}
else if (x4_gbaSupport->GetPhase() == CGBASupport::EPhase::Failed)
{
CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
SetUIText(EUIType::LinkFailed);
}
break;
case EUIType::Complete:
return EAction::Complete;

View File

@ -498,6 +498,7 @@ void CMemoryCardDriver::StartCardFormat()
void CMemoryCardDriver::UpdateMountCard(ECardResult result)
{
printf("MOUNTCARD\n");
switch (result)
{
case ECardResult::READY:
@ -517,6 +518,7 @@ void CMemoryCardDriver::UpdateMountCard(ECardResult result)
void CMemoryCardDriver::UpdateCardProbe()
{
printf("PROBECARD\n");
auto result = CMemoryCardSys::CardProbe(x0_cardPort);
switch (result.x0_error)
{
@ -544,6 +546,7 @@ void CMemoryCardDriver::UpdateCardProbe()
void CMemoryCardDriver::UpdateCardCheck(ECardResult result)
{
printf("CARDCHECK\n");
switch (result)
{
case ECardResult::READY:
@ -565,6 +568,7 @@ void CMemoryCardDriver::UpdateCardCheck(ECardResult result)
void CMemoryCardDriver::UpdateFileDeleteBad(ECardResult result)
{
printf("DELETEBAD\n");
if (result == ECardResult::READY)
{
x100_mcFileInfos[x194_fileIdx].first = EFileState::NoFile;
@ -587,6 +591,7 @@ void CMemoryCardDriver::UpdateFileDeleteBad(ECardResult result)
void CMemoryCardDriver::UpdateFileRead(ECardResult result)
{
printf("FILEREAD\n");
if (result == ECardResult::READY)
{
auto& fileInfo = x100_mcFileInfos[x194_fileIdx];
@ -631,6 +636,7 @@ void CMemoryCardDriver::UpdateFileRead(ECardResult result)
void CMemoryCardDriver::UpdateFileDeleteAlt(ECardResult result)
{
printf("DELETEALT\n");
if (result == ECardResult::READY)
{
x10_state = EState::Ready;
@ -643,6 +649,7 @@ void CMemoryCardDriver::UpdateFileDeleteAlt(ECardResult result)
void CMemoryCardDriver::UpdateFileCreate(ECardResult result)
{
printf("FILECREATE\n");
if (result == ECardResult::READY)
{
x10_state = EState::FileCreateDone;
@ -654,6 +661,7 @@ void CMemoryCardDriver::UpdateFileCreate(ECardResult result)
void CMemoryCardDriver::UpdateFileWrite(ECardResult result)
{
printf("FILEWRITE\n");
if (result == ECardResult::READY)
{
ECardResult xferResult = x198_fileInfo->PumpCardTransfer();
@ -681,6 +689,7 @@ void CMemoryCardDriver::UpdateFileWrite(ECardResult result)
void CMemoryCardDriver::UpdateFileCreateTransactional(ECardResult result)
{
printf("CREATETRANS\n");
if (result == ECardResult::READY)
{
x10_state = EState::FileCreateTransactionalDone;
@ -692,6 +701,7 @@ void CMemoryCardDriver::UpdateFileCreateTransactional(ECardResult result)
void CMemoryCardDriver::UpdateFileWriteTransactional(ECardResult result)
{
printf("WRITETRANS\n");
if (result == ECardResult::READY)
{
ECardResult xferResult = x198_fileInfo->PumpCardTransfer();
@ -722,6 +732,7 @@ void CMemoryCardDriver::UpdateFileWriteTransactional(ECardResult result)
void CMemoryCardDriver::UpdateFileDeleteAltTransactional(ECardResult result)
{
printf("DELETEALTTRANS\n");
if (result == ECardResult::READY)
{
x10_state = EState::FileDeleteAltTransactionalDone;
@ -734,6 +745,7 @@ void CMemoryCardDriver::UpdateFileDeleteAltTransactional(ECardResult result)
void CMemoryCardDriver::UpdateFileRenameBtoA(ECardResult result)
{
printf("BTOA\n");
if (result == ECardResult::READY)
{
x10_state = EState::DriverClosed;
@ -745,6 +757,7 @@ void CMemoryCardDriver::UpdateFileRenameBtoA(ECardResult result)
void CMemoryCardDriver::UpdateCardFormat(ECardResult result)
{
printf("FORMAT\n");
if (result == ECardResult::READY)
x10_state = EState::CardFormatted;
else if (result == ECardResult::BROKEN)

2
hecl

@ -1 +1 @@
Subproject commit 0c49e4583b764efaf5723ea5e4bf15f6363afaea
Subproject commit 3d28db642414aeffb0e6ad39555487b5674642cd

@ -1 +1 @@
Subproject commit 8ed773d16ff83e5885315db5382d7f8f8517a8b9
Subproject commit 11d1c676c4b776561bcfa3960a89c2d0775254fa