Merge pull request #862 from tambry/Fixes

cellSail fixes, split GetRegBySPR into ReadSPR and WriteSPR, added 0x10c case for them
This commit is contained in:
Alexandro Sánchez Bach 2014-11-15 15:49:20 +01:00
commit 2e40123557
3 changed files with 40 additions and 15 deletions

View File

@ -133,21 +133,39 @@ private:
return ctr_ok && cond_ok;
}
u64& GetRegBySPR(u32 spr)
u64 ReadSPR(u32 spr)
{
const u32 n = (spr >> 5) | ((spr & 0x1f) << 5);
switch(n)
switch (n)
{
case 0x001: return CPU.XER.XER;
case 0x008: return CPU.LR;
case 0x009: return CPU.CTR;
case 0x100: return CPU.USPRG0;
case 0x10C: return CPU.TBL;
}
UNK(fmt::Format("GetRegBySPR error: Unknown SPR 0x%x!", n));
UNK(fmt::Format("ReadSPR error: Unknown SPR 0x%x!", n));
return CPU.XER.XER;
}
void WriteSPR(u32 spr, u64 value)
{
const u32 n = (spr >> 5) | ((spr & 0x1f) << 5);
switch (n)
{
case 0x001: CPU.XER.XER = value; return;
case 0x008: CPU.LR = value; return;
case 0x009: CPU.CTR = value; return;
case 0x100: CPU.USPRG0 = value; return;
case 0x10C: CPU.TBL = value; return;
}
UNK(fmt::Format("WriteSPR error: Unknown SPR 0x%x!", n));
return;
}
void TDI(u32 to, u32 ra, s32 simm16)
{
@ -2911,7 +2929,7 @@ private:
}
void MFSPR(u32 rd, u32 spr)
{
CPU.GPR[rd] = GetRegBySPR(spr);
CPU.GPR[rd] = ReadSPR(spr);
}
void LWAX(u32 rd, u32 ra, u32 rb)
{
@ -3062,7 +3080,7 @@ private:
}
void MTSPR(u32 spr, u32 rs)
{
GetRegBySPR(spr) = CPU.GPR[rs];
WriteSPR(spr, CPU.GPR[rs]);
}
void DCBI(u32 ra, u32 rb)
{

View File

@ -43,18 +43,18 @@ u32 map_offset_pos = 0;
u32 gcmGetLocalMemorySize(u32 sdk_version)
{
if (sdk_version >= 0x00220000) {
return 0x0F900000; // 249MB
return 0x0F900000; // 249MB
}
if (sdk_version >= 0x00200000) {
return 0x0F200000; // 242MB
return 0x0F200000; // 242MB
}
if (sdk_version >= 0x00190000) {
return 0x0EA00000; // 234MB
return 0x0EA00000; // 234MB
}
if (sdk_version >= 0x00180000) {
return 0x0E800000; // 232MB
return 0x0E800000; // 232MB
}
return 0x0E000000; // 224MB
return 0x0E000000; // 224MB
}
CellGcmOffsetTable offsetTable;

View File

@ -71,17 +71,24 @@ int cellSailDescriptorGetMediaInfo()
int cellSailDescriptorSetAutoSelection(vm::ptr<CellSailDescriptor> pSelf, bool autoSelection)
{
cellSail->Todo("cellSailDescriptorSetAutoSelection(pSelf_addr=0x%x, autoSelection=%b)", pSelf.addr(), autoSelection);
cellSail->Todo("cellSailDescriptorSetAutoSelection(pSelf_addr=0x%x, autoSelection=%s)", pSelf.addr(), autoSelection ? "true" : "false");
pSelf->autoSelection = autoSelection;
if (pSelf) {
pSelf->autoSelection = autoSelection;
return autoSelection;
}
return autoSelection;
return CELL_OK;
}
int cellSailDescriptorIsAutoSelection(vm::ptr<CellSailDescriptor> pSelf)
{
cellSail->Warning("cellSailDescriptorIsAutoSelection(pSelf_addr=0x%x)", pSelf.addr());
return pSelf->autoSelection;
if (pSelf)
return pSelf->autoSelection;
return CELL_OK;
}
int cellSailDescriptorCreateDatabase()
@ -595,7 +602,7 @@ int cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailD
{
cellSail->Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr());
if (pSelf->descriptors < 3 && pDesc)
if (pSelf && pSelf->descriptors < 3 && pDesc)
{
pSelf->descriptors++;
pSelf->registeredDescriptors[pSelf->descriptors] = pDesc;