mirror of
https://github.com/libretro/Play-.git
synced 2025-01-26 19:24:40 +00:00
Added missing Iop module stubs for Castlevania. And fixed a big bad bug in PS2OS...
git-svn-id: http://svn.purei.org/purei/trunk@330 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
f75e04c158
commit
741bceb412
16
Purei.vcproj
16
Purei.vcproj
@ -915,6 +915,22 @@
|
||||
RelativePath=".\Source\iop\Iop_Timrman.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\iop\Iop_Unknown.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\iop\Iop_Unknown.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\iop\Iop_Unknown2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\iop\Iop_Unknown2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\iop\IopBios.cpp"
|
||||
>
|
||||
|
@ -301,21 +301,21 @@ void CPS2OS::LoadELF(CStream& stream, const char* sExecName)
|
||||
// pELF = new CELF(pStream);
|
||||
// memcpy(m_ram + 0x01000000, pELF->m_pData, pELF->m_nLenght);
|
||||
// delete pELF;
|
||||
/*
|
||||
int i;
|
||||
uint32 nVal;
|
||||
for(i = 0; i < 0x02000000 / 4; i++)
|
||||
{
|
||||
nVal = ((uint32*)m_ram)[i];
|
||||
if((nVal & 0xFFFF) == 0x95B0)
|
||||
{
|
||||
//if((nVal & 0xFC000000) != 0x0C000000)
|
||||
{
|
||||
printf("Allo: 0x%0.8X\r\n", i * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// int i;
|
||||
// uint32 nVal;
|
||||
// for(i = 0; i < 0x02000000 / 4; i++)
|
||||
// {
|
||||
// nVal = ((uint32*)m_ram)[i];
|
||||
// if((nVal & 0xFFFF) == 0xE88C)
|
||||
// {
|
||||
// //if((nVal & 0xFC000000) != 0x0C000000)
|
||||
// {
|
||||
// printf("Allo: 0x%0.8X\r\n", i * 4);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
int i;
|
||||
uint32 nVal;
|
||||
@ -1447,7 +1447,9 @@ void CPS2OS::sc_CreateThread()
|
||||
pThread = GetThread(GetCurrentThreadId());
|
||||
nHeapBase = pThread->nHeapBase;
|
||||
|
||||
pThread = GetThread(nID);
|
||||
assert(pThreadParam->nPriority < 128);
|
||||
|
||||
pThread = GetThread(nID);
|
||||
pThread->nValid = 1;
|
||||
pThread->nStatus = THREAD_SUSPENDED;
|
||||
pThread->nStackBase = pThreadParam->nStackBase;
|
||||
@ -1670,13 +1672,13 @@ void CPS2OS::sc_ReferThreadStatus()
|
||||
|
||||
if(nStatusPtr != 0)
|
||||
{
|
||||
THREADPARAM* pThreadParam;
|
||||
THREADPARAM* pThreadParam = reinterpret_cast<THREADPARAM*>(&m_ram[nStatusPtr]);
|
||||
|
||||
pThreadParam = (THREADPARAM*)(&m_ram[nStatusPtr]);
|
||||
pThreadParam->nStatus = nRet;
|
||||
pThreadParam->nPriority = pThread->nPriority;
|
||||
pThreadParam->nStackBase = pThread->nStackBase;
|
||||
pThreadParam->nStackSize = pThread->nStackSize;
|
||||
pThreadParam->nStatus = nRet;
|
||||
pThreadParam->nPriority = pThread->nPriority;
|
||||
pThreadParam->nCurrentPriority = pThread->nPriority;
|
||||
pThreadParam->nStackBase = pThread->nStackBase;
|
||||
pThreadParam->nStackSize = pThread->nStackSize;
|
||||
}
|
||||
|
||||
m_ee.m_State.nGPR[SC_RETURN].nV[0] = nRet;
|
||||
@ -2256,7 +2258,7 @@ void CPS2OS::DisassembleSysCall(uint8 nFunc)
|
||||
|
||||
if(sDescription.length() != 0)
|
||||
{
|
||||
CLog::GetInstance().Print(LOG_NAME, "%s\r\n", sDescription.c_str());
|
||||
CLog::GetInstance().Print(LOG_NAME, "%i: %s\r\n", GetCurrentThreadId(), sDescription.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ private:
|
||||
uint32 nStackSize;
|
||||
uint32 nGP;
|
||||
uint32 nPriority;
|
||||
uint32 nCurrentPriority;
|
||||
};
|
||||
|
||||
struct SEMAPHORE
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "Iop_Thevent.h"
|
||||
#include "Iop_Timrman.h"
|
||||
#include "Iop_Intrman.h"
|
||||
#include "Iop_Unknown.h"
|
||||
#include "Iop_Unknown2.h"
|
||||
#include <vector>
|
||||
#include <time.h>
|
||||
|
||||
@ -109,6 +111,14 @@ void CIopBios::Reset()
|
||||
RegisterModule(m_padman);
|
||||
}
|
||||
|
||||
//Custom modules
|
||||
{
|
||||
RegisterModule(new Iop::CUnknown(m_sif));
|
||||
}
|
||||
{
|
||||
RegisterModule(new Iop::CUnknown2(m_sif));
|
||||
}
|
||||
|
||||
const int sifDmaBufferSize = 0x1000;
|
||||
uint32 sifDmaBufferPtr = m_sysmem->AllocateMemory(sifDmaBufferSize, 0);
|
||||
m_sif.SetDmaBuffer(m_ram + sifDmaBufferPtr, sifDmaBufferSize);
|
||||
|
@ -285,6 +285,9 @@ void CCdvdfsv::StreamCmd(uint32* args, uint32 argsSize, uint32* ret, uint32 retS
|
||||
CLog::GetInstance().Print(LOG_NAME, "StreamSeek(pos = 0x%0.8X);\r\n", \
|
||||
nSector);
|
||||
break;
|
||||
default:
|
||||
CLog::GetInstance().Print(LOG_NAME, "Unknown stream command used.\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
55
Source/iop/Iop_Unknown.cpp
Normal file
55
Source/iop/Iop_Unknown.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "IOP_Unknown.h"
|
||||
|
||||
//This module is required for Castlevania: Yami no Juin to work.
|
||||
|
||||
using namespace Iop;
|
||||
using namespace std;
|
||||
|
||||
CUnknown::CUnknown(CSIF& sif)
|
||||
{
|
||||
sif.RegisterModule(MODULE_ID, this);
|
||||
}
|
||||
|
||||
CUnknown::~CUnknown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string CUnknown::GetId() const
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
void CUnknown::Invoke(CMIPS&, unsigned int)
|
||||
{
|
||||
throw runtime_error("Not implemented.");
|
||||
}
|
||||
|
||||
void CUnknown::Invoke(uint32 nMethod, uint32* pArgs, uint32 nArgsSize, uint32* pRet, uint32 nRetSize, uint8* ram)
|
||||
{
|
||||
switch(nMethod)
|
||||
{
|
||||
case 0x01000000:
|
||||
{
|
||||
if(nRetSize == 0x7C)
|
||||
{
|
||||
(reinterpret_cast<uint16*>(pRet))[0x30] |= 0x7;
|
||||
(reinterpret_cast<uint16*>(pRet))[0x31] |= 0x7;
|
||||
|
||||
(reinterpret_cast<uint16*>(pRet))[0x30] ^= 0x8;
|
||||
(reinterpret_cast<uint16*>(pRet))[0x31] ^= 0x8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CUnknown::SaveState(CZipArchiveWriter& archive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CUnknown::LoadState(CZipArchiveReader& archive)
|
||||
{
|
||||
|
||||
}
|
30
Source/iop/Iop_Unknown.h
Normal file
30
Source/iop/Iop_Unknown.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef _IOP_UNKNOWN_H_
|
||||
#define _IOP_UNKNOWN_H_
|
||||
|
||||
#include "Iop_Module.h"
|
||||
#include "../SIF.h"
|
||||
#include "zip/ZipArchiveWriter.h"
|
||||
#include "zip/ZipArchiveReader.h"
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
class CUnknown : public CModule, public CSifModule
|
||||
{
|
||||
public:
|
||||
CUnknown(CSIF&);
|
||||
virtual ~CUnknown();
|
||||
|
||||
std::string GetId() const;
|
||||
void Invoke(CMIPS&, unsigned int);
|
||||
virtual void Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*);
|
||||
virtual void SaveState(CZipArchiveWriter&);
|
||||
virtual void LoadState(CZipArchiveReader&);
|
||||
|
||||
enum MODULE_ID
|
||||
{
|
||||
MODULE_ID = 0x00012345,
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
51
Source/iop/Iop_Unknown2.cpp
Normal file
51
Source/iop/Iop_Unknown2.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include <assert.h>
|
||||
#include "Iop_Unknown2.h"
|
||||
|
||||
//This module is also used in Castlevania : Yami no Juin
|
||||
|
||||
using namespace Iop;
|
||||
using namespace std;
|
||||
|
||||
CUnknown2::CUnknown2(CSIF& sif)
|
||||
{
|
||||
sif.RegisterModule(MODULE_ID, this);
|
||||
}
|
||||
|
||||
CUnknown2::~CUnknown2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string CUnknown2::GetId() const
|
||||
{
|
||||
return "unknown2";
|
||||
}
|
||||
|
||||
void CUnknown2::Invoke(CMIPS&, unsigned int)
|
||||
{
|
||||
throw runtime_error("Not implemented.");
|
||||
}
|
||||
|
||||
void CUnknown2::Invoke(uint32 nMethod, uint32* pArgs, uint32 nArgsSize, uint32* pRet, uint32 nRetSize, uint8* ram)
|
||||
{
|
||||
switch(nMethod)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
assert(nRetSize >= 4);
|
||||
|
||||
((uint32*)pRet)[0] = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CUnknown2::SaveState(CZipArchiveWriter& archive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CUnknown2::LoadState(CZipArchiveReader& archive)
|
||||
{
|
||||
|
||||
}
|
31
Source/iop/Iop_Unknown2.h
Normal file
31
Source/iop/Iop_Unknown2.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef _IOP_UNKNOWN2_H_
|
||||
#define _IOP_UNKNOWN2_H_
|
||||
|
||||
#include "Iop_Module.h"
|
||||
#include "../SIF.h"
|
||||
#include "zip/ZipArchiveWriter.h"
|
||||
#include "zip/ZipArchiveReader.h"
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
class CUnknown2 : public CModule, public CSifModule
|
||||
{
|
||||
public:
|
||||
CUnknown2(CSIF&);
|
||||
virtual ~CUnknown2();
|
||||
|
||||
std::string GetId() const;
|
||||
void Invoke(CMIPS&, unsigned int);
|
||||
virtual void Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*);
|
||||
virtual void SaveState(CZipArchiveWriter&);
|
||||
virtual void LoadState(CZipArchiveReader&);
|
||||
|
||||
enum MODULE_ID
|
||||
{
|
||||
MODULE_ID = 0x00000030,
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user