Skip to content

Commit

Permalink
Fix style.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpd002 committed Dec 21, 2023
1 parent e90f046 commit 6060849
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 149 deletions.
2 changes: 1 addition & 1 deletion Source/MIPSAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ bool CMIPSAnalysis::TryGetSJISLatinStringAtAddress(CMIPS* context, uint32 addres
DECODE_STATE state = DECODE_STATE_NORMAL;

result.clear();

while(1)
{
uint8 byte = context->m_pMemoryMap->GetByte(address++);
Expand Down
6 changes: 3 additions & 3 deletions Source/iop/namco_sys147/Iop_NamcoNANDDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ using namespace Iop;
using namespace Iop::Namco;

CNamcoNANDDevice::CNamcoNANDDevice(std::unique_ptr<Framework::CStream> nandDumpStream, uint32 rootSector)
: m_nandDumpStream(std::move(nandDumpStream))
, m_nandReader(*m_nandDumpStream.get(), rootSector)
: m_nandDumpStream(std::move(nandDumpStream))
, m_nandReader(*m_nandDumpStream.get(), rootSector)
{
}

Expand Down Expand Up @@ -43,7 +43,7 @@ Framework::CStream* CNamcoNANDDevice::GetFile(uint32 flags, const char* path)
break;
}
}

if(!found)
{
return nullptr;
Expand Down
201 changes: 99 additions & 102 deletions Source/iop/namco_sys147/Iop_NamcoSys147.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ enum
};

CSys147::CSys147(CSifMan& sifMan, const std::string& gameId)
: m_gameId(gameId)
: m_gameId(gameId)
{
m_module000 = CSifModuleAdapter(std::bind(&CSys147::Invoke000, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
m_module001 = CSifModuleAdapter(std::bind(&CSys147::Invoke001, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
m_module002 = CSifModuleAdapter(std::bind(&CSys147::Invoke002, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
m_module003 = CSifModuleAdapter(std::bind(&CSys147::Invoke003, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
m_module200 = CSifModuleAdapter(std::bind(&CSys147::Invoke200, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
m_module201 = CSifModuleAdapter(std::bind(&CSys147::Invoke201, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
m_module99 = CSifModuleAdapter(std::bind(&CSys147::Invoke99, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));

sifMan.RegisterModule(MODULE_ID_000, &m_module000);
sifMan.RegisterModule(MODULE_ID_001, &m_module001);
sifMan.RegisterModule(MODULE_ID_002, &m_module002);
sifMan.RegisterModule(MODULE_ID_003, &m_module003);
sifMan.RegisterModule(MODULE_ID_200, &m_module200);
sifMan.RegisterModule(MODULE_ID_201, &m_module201);
sifMan.RegisterModule(MODULE_ID_99, &m_module99);

m_switchStates[SWITCH_TEST] = 0;
m_switchStates[SWITCH_ENTER] = 0;
m_switchStates[SWITCH_UP] = 0;
Expand Down Expand Up @@ -100,7 +100,6 @@ void CSys147::SetButtonState(unsigned int padNumber, PS2::CControllerInfo::BUTTO

void CSys147::SetAxisState(unsigned int padNumber, PS2::CControllerInfo::BUTTON button, uint8 axisValue, uint8* ram)
{

}

void CSys147::Invoke(CMIPS& context, unsigned int functionId)
Expand Down Expand Up @@ -157,17 +156,17 @@ bool CSys147::Invoke200(uint32 method, uint32* args, uint32 argsSize, uint32* re
switch(method)
{
case 0:
{
//Write
//0 -> 0x400 -> Data to write
//0x400 -> Offset
//0x404 -> Size
uint32 offset = args[0x100];
uint32 size = args[0x101];
assert(size <= 0x400);
WriteBackupRam(offset, reinterpret_cast<const uint8*>(args), size);
}
break;
{
//Write
//0 -> 0x400 -> Data to write
//0x400 -> Offset
//0x404 -> Size
uint32 offset = args[0x100];
uint32 size = args[0x101];
assert(size <= 0x400);
WriteBackupRam(offset, reinterpret_cast<const uint8*>(args), size);
}
break;
default:
CLog::GetInstance().Warn(LOG_NAME, "Unknown method invoked (0x%08X, 0x%08X).\r\n", 0x200, method);
break;
Expand All @@ -180,16 +179,16 @@ bool CSys147::Invoke201(uint32 method, uint32* args, uint32 argsSize, uint32* re
switch(method)
{
case 0:
{
//Read
//0x0 -> Offset
//0x4 -> Size
uint32 offset = args[0];
uint32 size = args[1];
assert(size <= 0x400);
ReadBackupRam(offset, reinterpret_cast<uint8*>(ret), size);
}
break;
{
//Read
//0x0 -> Offset
//0x4 -> Size
uint32 offset = args[0];
uint32 size = args[1];
assert(size <= 0x400);
ReadBackupRam(offset, reinterpret_cast<uint8*>(ret), size);
}
break;
default:
CLog::GetInstance().Warn(LOG_NAME, "Unknown method invoked (0x%08X, 0x%08X).\r\n", 0x201, method);
break;
Expand Down Expand Up @@ -300,7 +299,7 @@ bool CSys147::Invoke99(uint32 method, uint32* args, uint32 argsSize, uint32* ret
uint8 channel = packet->data[0];
uint8 inputSize = packet->data[1];
CLog::GetInstance().Warn(LOG_NAME, "Received command buffer channel: %d, size: %d\r\n",
channel, inputSize);
channel, inputSize);
MODULE_99_PACKET reply = {};
reply.type = 2;
reply.command = 0x31;
Expand Down Expand Up @@ -397,81 +396,80 @@ void CSys147::ProcessIcCard(MODULE_99_PACKET& output, const MODULE_99_PACKET& in
switch(commandId)
{
case 0x78:
{
//??
assert(dataSize == 0x07);
replySize = 6;
output.data[replyBase + 3] = 0x00; //Command result?
output.data[replyBase + 4] = 0x00;
output.data[replyBase + 5] = 0xFF;

}
break;
{
//??
assert(dataSize == 0x07);
replySize = 6;
output.data[replyBase + 3] = 0x00; //Command result?
output.data[replyBase + 4] = 0x00;
output.data[replyBase + 5] = 0xFF;
}
break;
case 0x7A:
{
//Ok next?
assert(dataSize == 0x12);
replySize = 4;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
{
//Ok next?
assert(dataSize == 0x12);
replySize = 4;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
case 0x7B:
{
assert(dataSize == 0x05);
replySize = 6;
output.data[replyBase + 3] = 0x00; //Command result? (0x03 -> No IC card)
output.data[replyBase + 4] = 0x00; //??
output.data[replyBase + 5] = 0x00; //??
}
break;
{
assert(dataSize == 0x05);
replySize = 6;
output.data[replyBase + 3] = 0x00; //Command result? (0x03 -> No IC card)
output.data[replyBase + 4] = 0x00; //??
output.data[replyBase + 5] = 0x00; //??
}
break;
case 0x80:
{
//??
assert(dataSize == 0x05);
replySize = 4;
output.data[replyBase + 3] = 0x0D; //Command result?
}
break;
{
//??
assert(dataSize == 0x05);
replySize = 4;
output.data[replyBase + 3] = 0x0D; //Command result?
}
break;
case 0x9F:
{
//??
assert(dataSize == 0x0D);
replySize = 4;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
{
//??
assert(dataSize == 0x0D);
replySize = 4;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
case 0xA7:
{
//Init?
assert(dataSize == 0x0D);
replySize = 4;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
{
//Init?
assert(dataSize == 0x0D);
replySize = 4;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
case 0xAC:
{
//Some key stuff (parity)? (game expects 8 bytes in payload)
assert(dataSize == 0x05);
replySize = 12;
output.data[replyBase + 3] = 0x00; //Command result?
output.data[replyBase + 4] = 0xAA;
output.data[replyBase + 5] = 0xAA;
output.data[replyBase + 6] = 0xAA;
output.data[replyBase + 7] = 0xAA;
output.data[replyBase + 8] = 0x55;
output.data[replyBase + 9] = 0x55;
output.data[replyBase + 10] = 0x55;
output.data[replyBase + 11] = 0x55;
}
break;
{
//Some key stuff (parity)? (game expects 8 bytes in payload)
assert(dataSize == 0x05);
replySize = 12;
output.data[replyBase + 3] = 0x00; //Command result?
output.data[replyBase + 4] = 0xAA;
output.data[replyBase + 5] = 0xAA;
output.data[replyBase + 6] = 0xAA;
output.data[replyBase + 7] = 0xAA;
output.data[replyBase + 8] = 0x55;
output.data[replyBase + 9] = 0x55;
output.data[replyBase + 10] = 0x55;
output.data[replyBase + 11] = 0x55;
}
break;
case 0xAF:
{
//More key stuff (checksum)? (game expects 16 bytes in payload)
assert(dataSize == 0x05);
replySize = 20;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
{
//More key stuff (checksum)? (game expects 16 bytes in payload)
assert(dataSize == 0x05);
replySize = 20;
output.data[replyBase + 3] = 0x00; //Command result?
}
break;
default:
assert(false);
break;
Expand Down Expand Up @@ -499,7 +497,6 @@ uint8 CSys147::ComputePacketChecksum(const MODULE_99_PACKET& packet)
return checksum;
}


//TODO: This is copied from Sys246/256. Move this somewhere else

fs::path GetArcadeSavePath()
Expand Down
10 changes: 5 additions & 5 deletions Source/iop/namco_sys147/Iop_NamcoSys147.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ namespace Iop
MODULE_ID_003 = 0x01470003,
MODULE_ID_200 = 0x01470200, //S147RPC_REQID_SRAM_WRITE
MODULE_ID_201 = 0x01470201, //S147RPC_REQID_SRAM_READ
MODULE_ID_99 = 0x00014799, //S147LINK
MODULE_ID_99 = 0x00014799, //S147LINK
};

struct MODULE_99_PACKET
{
uint8 type;
Expand All @@ -56,9 +56,9 @@ namespace Iop

void ProcessIcCard(MODULE_99_PACKET&, const MODULE_99_PACKET&);
uint8 ComputePacketChecksum(const MODULE_99_PACKET&);

static constexpr int32 BACKUP_RAM_SIZE = 0x20000;

void ReadBackupRam(uint32, uint8*, uint32);
void WriteBackupRam(uint32, const uint8*, uint32);

Expand All @@ -69,7 +69,7 @@ namespace Iop
CSifModuleAdapter m_module200;
CSifModuleAdapter m_module201;
CSifModuleAdapter m_module99;

std::string m_gameId;

std::vector<MODULE_99_PACKET> m_pendingReplies;
Expand Down
4 changes: 2 additions & 2 deletions Source/iop/namco_sys147/NamcoSys147NANDReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using namespace Namco;

CSys147NANDReader::CSys147NANDReader(Framework::CStream& stream, uint32 baseSector)
: m_stream(stream)
, m_baseSector(baseSector)
: m_stream(stream)
, m_baseSector(baseSector)
{
m_baseSector = baseSector;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/iop/namco_sys147/NamcoSys147NANDReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ namespace Namco
typedef std::vector<DIRENTRY> Directory;

CSys147NANDReader(Framework::CStream&, uint32);

Directory ReadDirectory(uint32);
std::vector<uint8> ReadFile(uint32, uint32);

private:
void ReadSector(uint32, void*);

static constexpr uint32 m_sectorSize = 0x840;
static constexpr uint32 m_dataSize = 0x800;
static constexpr uint32 m_eccSize = 0x40;
Expand Down
Loading

0 comments on commit 6060849

Please sign in to comment.