Skip to content

Commit

Permalink
Merge pull request #1181 from kernle32dll/fix-ironman
Browse files Browse the repository at this point in the history
Inform about new disc via CdTrayReq
  • Loading branch information
jpd002 authored Mar 19, 2022
2 parents c6590e0 + b425b7d commit fda697c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Source/iop/Iop_Cdvdman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define STATE_FILENAME ("iop_cdvdman/state.xml")

This comment has been minimized.

Copy link
@cococho4456556

cococho4456556 Mar 26, 2022

u7y68´ñb

#define STATE_CALLBACK_ADDRESS ("CallbackAddress")
#define STATE_STATUS ("Status")
#define STATE_DISCCHANGED ("DiscChanged")
#define STATE_PENDING_COMMAND ("PendingCommand")

#define FUNCTION_CDINIT "CdInit"
Expand Down Expand Up @@ -52,6 +53,7 @@ void CCdvdman::LoadState(Framework::CZipArchiveReader& archive)
CRegisterStateFile registerFile(*archive.BeginReadFile(STATE_FILENAME));
m_callbackPtr = registerFile.GetRegister32(STATE_CALLBACK_ADDRESS);
m_status = registerFile.GetRegister32(STATE_STATUS);
m_discChanged = registerFile.GetRegister32(STATE_DISCCHANGED);
m_pendingCommand = static_cast<COMMAND>(registerFile.GetRegister32(STATE_PENDING_COMMAND));
}

Expand All @@ -60,6 +62,7 @@ void CCdvdman::SaveState(Framework::CZipArchiveWriter& archive) const
auto registerFile = new CRegisterStateFile(STATE_FILENAME);
registerFile->SetRegister32(STATE_CALLBACK_ADDRESS, m_callbackPtr);
registerFile->SetRegister32(STATE_STATUS, m_status);
registerFile->SetRegister32(STATE_DISCCHANGED, m_discChanged);
registerFile->SetRegister32(STATE_PENDING_COMMAND, m_pendingCommand);
archive.InsertFile(registerFile);
}
Expand Down Expand Up @@ -533,7 +536,16 @@ uint32 CCdvdman::CdTrayReq(uint32 mode, uint32 trayCntPtr)
mode, trayCntPtr);

auto trayCnt = reinterpret_cast<uint32*>(m_ram + trayCntPtr);
(*trayCnt) = 0;

if(mode == CDVD_TRAY_CHECK && m_discChanged)
{
(*trayCnt) = 1;
m_discChanged = false;
}
else
{
(*trayCnt) = 0;
}

return 1;
}
Expand Down
8 changes: 8 additions & 0 deletions Source/iop/Iop_Cdvdman.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ namespace Iop
class CCdvdman : public CModule
{
public:
enum CDVD_TRAQ_REQUEST_MODE
{
CDVD_TRAY_OPEN = 0,
CDVD_TRAY_CLOSE = 1,
CDVD_TRAY_CHECK = 2,
};

enum CDVD_STATUS
{
CDVD_STATUS_STOPPED = 0,
Expand Down Expand Up @@ -100,6 +107,7 @@ namespace Iop

uint32 m_callbackPtr = 0;
uint32 m_status = CDVD_STATUS_PAUSED;
uint32 m_discChanged = 1;
uint32 m_streamPos = 0;
uint32 m_streamBufferSize = 0;
COMMAND m_pendingCommand = COMMAND_NONE;
Expand Down

0 comments on commit fda697c

Please sign in to comment.