From b2c619da61610bdcf3e6176d675d67814965f78a Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 28 Sep 2008 16:49:58 +0000 Subject: [PATCH] Submit all kind of misc little changes and cleanup so I get a clean slate. There should be nothing in here that really changes anything important, except fixing some types in the filesystemgc stuff. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@717 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/Boot/Boot.cpp | 20 +- Source/Core/Core/Src/CoreParameter.cpp | 1 - .../Src/Debugger/Debugger_BreakPoints.cpp | 4 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 32 +- .../Interpreter_SystemRegisters.cpp | 3 +- Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp | 14 +- Source/Core/Core/Src/PowerPC/PPCAnalyst.h | 8 +- Source/Core/Core/Src/PowerPC/SignatureDB.cpp | 4 +- Source/Core/Core/Src/PowerPC/SymbolDB.cpp | 22 +- Source/Core/Core/Src/PowerPC/SymbolDB.h | 13 +- Source/Core/DebuggerWX/DebuggerWX.vcproj | 290 +++++++++--------- Source/Core/DiscIO/Src/FileBlob.cpp | 2 +- Source/Core/DiscIO/Src/FileSystemGCWii.cpp | 6 +- Source/Core/DiscIO/Src/FileSystemGCWii.h | 4 +- Source/Core/DiscIO/Src/Filesystem.h | 9 +- 15 files changed, 201 insertions(+), 231 deletions(-) diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index f6d84e8b93..3985438eda 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -49,7 +49,7 @@ void CBoot::Load_FST(bool _bIsWii) { - if(VolumeHandler::IsValid()) + if (VolumeHandler::IsValid()) { // copy first 20 bytes of disc to start of Mem 1 VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20); @@ -58,11 +58,11 @@ void CBoot::Load_FST(bool _bIsWii) Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180); u32 shift = 0; - if(_bIsWii) + if (_bIsWii) shift = 2; - u32 fstOffset = VolumeHandler::Read32(0x0424) << shift; - u32 fstSize = VolumeHandler::Read32(0x0428) << shift; + u32 fstOffset = VolumeHandler::Read32(0x0424) << shift; + u32 fstSize = VolumeHandler::Read32(0x0428) << shift; u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift; u32 arenaHigh = 0x817FFFF4 - maxFstSize; @@ -150,7 +150,7 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara) g_symbolDB.Clear(); VideoInterface::PreInit(_StartupPara.bNTSC); - switch(_StartupPara.m_BootType) + switch (_StartupPara.m_BootType) { // GCM // =================================================================================== @@ -244,18 +244,12 @@ bool CBoot::BootUp(const SCoreStartupParameter& _StartupPara) } // load image or create virtual drive from directory - if(!_StartupPara.m_strDVDRoot.empty()) - { + if (!_StartupPara.m_strDVDRoot.empty()) VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii); - } - else if(!_StartupPara.m_strDefaultGCM.empty()) - { + else if (!_StartupPara.m_strDefaultGCM.empty()) VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM); - } else - { VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, elfWii); - } DVDInterface::SetDiscInside(VolumeHandler::IsValid()); diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 3c5d8c7d1d..3ce3aa8123 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -39,7 +39,6 @@ void SCoreStartupParameter::LoadDefaults() SelectedLanguage = 0; } - bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) { static const char *s_DataBasePath_EUR = "Data_EUR"; diff --git a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp b/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp index 53b61d5a19..9f22debd1c 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp +++ b/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp @@ -47,8 +47,8 @@ void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc) { if (Log) { - LOG(MEMMAP,"CHK %08x %s%i at %08x (%s)", - iValue, write ? "Write" : "Read", size*8, addr, + LOG(MEMMAP,"CHK %08x %s%i at %08x (%s)", + iValue, write ? "Write" : "Read", size*8, addr, g_symbolDB.GetDescription(addr)); } if (Break) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index 0ead07cbbc..7f64a25e6a 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -28,39 +28,32 @@ #include "VolumeCreator.h" #include "Filesystem.h" +// Hack +u8 coverByte = 0; + -// __________________________________________________________________________________________________ -// CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName ) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) , m_pVolume(NULL) , m_pFileSystem(NULL) { - m_pVolume = VolumeHandler::GetVolume(); if (m_pVolume) m_pFileSystem = DiscIO::CreateFileSystem(m_pVolume); } -// __________________________________________________________________________________________________ -// CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di() { delete m_pFileSystem; delete m_pVolume; } -// __________________________________________________________________________________________________ -// -bool -CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress) +bool CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress) { Memory::Write_U32(GetDeviceID(), _CommandAddress+4); return true; } -// __________________________________________________________________________________________________ -// bool CWII_IPC_HLE_Device_di::IOCtl(u32 _CommandAddress) { LOG(WII_IPC_HLE, "*******************************"); @@ -93,8 +86,6 @@ bool CWII_IPC_HLE_Device_di::IOCtl(u32 _CommandAddress) return true; } -// __________________________________________________________________________________________________ -// bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress) { PanicAlert("CWII_IPC_HLE_Device_di::IOCtlV() unknown"); @@ -104,11 +95,6 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress) return true; } -// Hack -u8 coverByte = 0; - -// __________________________________________________________________________________________________ -// u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize) { u32 Command = Memory::Read_U32(_BufferIn) >> 24; @@ -160,8 +146,8 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 case 0xd0: case 0x71: { - u32 Size = Memory::Read_U32(_BufferIn+0x04); - u64 DVDAddress = (u64)Memory::Read_U32(_BufferIn+0x08) << 2; + u32 Size = Memory::Read_U32(_BufferIn + 0x04); + u64 DVDAddress = (u64)Memory::Read_U32(_BufferIn + 0x08) << 2; const char* pFilename = m_pFileSystem->GetFileName(DVDAddress); if (pFilename != NULL) @@ -175,7 +161,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 if (Size > _BufferOutSize) { - PanicAlert("You try to read more data from the DVD than fit inside the out buffer. Clamp."); + PanicAlert("Detected attempt to read more data from the DVD than fit inside the out buffer. Clamp."); Size = _BufferOutSize; } @@ -244,7 +230,9 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 // DVDLowSeek case 0xab: - {} + { + // PanicAlert("DVDLowSeek"); + } break; // DVDLowStopMotor diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 092c231e63..009ddc9b0c 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -120,7 +120,8 @@ void UpdateFPSCR(UReg_FPSCR fp) #endif if (fp.VE || fp.OE || fp.UE || fp.ZE || fp.XE) { - PanicAlert("FPSCR - exceptions enabled. Please report."); + // PanicAlert("FPSCR - exceptions enabled. Please report."); + // Pokemon Colosseum does this. Gah. } // Also corresponding SSE rounding mode setting diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp index 23e91242cc..b9a5705b97 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp @@ -105,7 +105,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size) while (true) { func.size += 4; - if (func.size > 1024*16*4) //weird + if (func.size >= CODEBUFFER_SIZE * 4) //weird return false; UGeckoInstruction instr = (UGeckoInstruction)Memory::ReadUnchecked_U32(addr); @@ -311,7 +311,7 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, Todo todo = Nothing; //Symbol *f = g_symbolDB.GetSymbolFromAddr(address); - int maxsize = 20000; + int maxsize = CODEBUFFER_SIZE; //for now, all will return JustCopy :P /* if (f) @@ -408,7 +408,6 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, // Do analysis of the code, look for dependencies etc int numSystemInstructions = 0; - for (int i = 0; i < 32; i++) { gpa.firstRead[i] = -1; @@ -422,10 +421,9 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, { UGeckoInstruction inst = code[i].inst; if (PPCTables::UsesFPU(inst)) - { fpa.any = true; - } - GekkoOPInfo *opinfo = GetOpInfo(code[i].inst); + + const GekkoOPInfo *opinfo = GetOpInfo(code[i].inst); _assert_msg_(GEKKO, opinfo != 0, "Invalid Op - Error scanning %08x op %08x",address+i*4,inst); int flags = opinfo->flags; @@ -512,6 +510,8 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, for (int j = 0; j < numIn; j++) { int r = code[i].regsIn[j]; + if (r < 0 || r > 31) + PanicAlert("wtf"); if (gpa.firstRead[r] == -1) gpa.firstRead[r] = (short)(i); gpa.lastRead[r] = (short)(i); @@ -521,6 +521,8 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, for (int j = 0; j < numOut; j++) { int r = code[i].regsOut[j]; + if (r < 0 || r > 31) + PanicAlert("wtf"); if (gpa.firstWrite[r] == -1) gpa.firstWrite[r] = (short)(i); gpa.lastWrite[r] = (short)(i); diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.h b/Source/Core/Core/Src/PowerPC/PPCAnalyst.h index 5200d0a953..844d519138 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.h @@ -38,10 +38,10 @@ struct CodeOp //16B u32 address; u32 branchTo; //if 0, not a branch int branchToIndex; //index of target block - u8 regsOut[2]; - u8 regsIn[3]; - u8 fregOut; - u8 fregsIn[3]; + s8 regsOut[2]; + s8 regsIn[3]; + s8 fregOut; + s8 fregsIn[3]; bool isBranchTarget; bool wantsCR0; bool wantsCR1; diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp index 05a7f5db7c..5c955f8632 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp @@ -47,6 +47,8 @@ bool SignatureDB::Load(const char *filename) memset(&temp, 0, sizeof(temp)); fread(&temp, sizeof(temp), 1, f); + temp.name[sizeof(temp.name)-1] = 0; + DBFunc dbf; dbf.name = temp.name; dbf.size = temp.size; @@ -61,7 +63,7 @@ bool SignatureDB::Save(const char *filename) FILE *f = fopen(filename,"wb"); if (!f) { - LOG(HLE,"Database save failed"); + LOG(HLE, "Database save failed"); return false; } int fcount = (int)database.size(); diff --git a/Source/Core/Core/Src/PowerPC/SymbolDB.cpp b/Source/Core/Core/Src/PowerPC/SymbolDB.cpp index 9d3fed62d8..22233e08a0 100644 --- a/Source/Core/Core/Src/PowerPC/SymbolDB.cpp +++ b/Source/Core/Core/Src/PowerPC/SymbolDB.cpp @@ -179,16 +179,16 @@ void SymbolDB::FillInCallers() } } -void SymbolDB::PrintCalls(u32 funcAddr) +void SymbolDB::PrintCalls(u32 funcAddr) const { - XFuncMap::iterator iter = functions.find(funcAddr); + XFuncMap::const_iterator iter = functions.find(funcAddr); if (iter != functions.end()) { - Symbol &f = iter->second; + const Symbol &f = iter->second; LOG(HLE, "The function %s at %08x calls:", f.name.c_str(), f.address); - for (std::vector::iterator fiter = f.calls.begin(); fiter!=f.calls.end(); fiter++) + for (std::vector::const_iterator fiter = f.calls.begin(); fiter!=f.calls.end(); fiter++) { - XFuncMap::iterator n = functions.find(fiter->function); + XFuncMap::const_iterator n = functions.find(fiter->function); if (n != functions.end()) { LOG(CONSOLE,"* %08x : %s", fiter->callAddress, n->second.name.c_str()); @@ -201,16 +201,16 @@ void SymbolDB::PrintCalls(u32 funcAddr) } } -void SymbolDB::PrintCallers(u32 funcAddr) +void SymbolDB::PrintCallers(u32 funcAddr) const { - XFuncMap::iterator iter = functions.find(funcAddr); + XFuncMap::const_iterator iter = functions.find(funcAddr); if (iter != functions.end()) { - Symbol &f = iter->second; + const Symbol &f = iter->second; LOG(CONSOLE,"The function %s at %08x is called by:",f.name.c_str(),f.address); - for (std::vector::iterator fiter = f.callers.begin(); fiter != f.callers.end(); fiter++) + for (std::vector::const_iterator fiter = f.callers.begin(); fiter != f.callers.end(); fiter++) { - XFuncMap::iterator n = functions.find(fiter->function); + XFuncMap::const_iterator n = functions.find(fiter->function); if (n != functions.end()) { LOG(CONSOLE,"* %08x : %s", fiter->callAddress, n->second.name.c_str()); @@ -294,7 +294,7 @@ bool SymbolDB::LoadMap(const char *filename) return true; } -bool SymbolDB::SaveMap(const char *filename) +bool SymbolDB::SaveMap(const char *filename) const { FILE *f = fopen(filename, "w"); if (!f) diff --git a/Source/Core/Core/Src/PowerPC/SymbolDB.h b/Source/Core/Core/Src/PowerPC/SymbolDB.h index e413f35900..a58ee70a1b 100644 --- a/Source/Core/Core/Src/PowerPC/SymbolDB.h +++ b/Source/Core/Core/Src/PowerPC/SymbolDB.h @@ -48,12 +48,6 @@ struct Symbol analyzed(0) {} - ~Symbol() - { - callers.clear(); - calls.clear(); - } - std::string name; std::vector callers; //addresses of functions that call this function std::vector calls; //addresses of functions that are called by this function @@ -64,7 +58,6 @@ struct Symbol int numCalls; int type; int index; // only used for coloring the disasm view - int analyzed; }; @@ -125,10 +118,10 @@ public: void FillInCallers(); bool LoadMap(const char *filename); - bool SaveMap(const char *filename); + bool SaveMap(const char *filename) const; - void PrintCalls(u32 funcAddr); - void PrintCallers(u32 funcAddr); + void PrintCalls(u32 funcAddr) const; + void PrintCallers(u32 funcAddr) const; void LogFunctionCall(u32 addr); }; diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj index 69291eb274..87bb1ffb45 100644 --- a/Source/Core/DebuggerWX/DebuggerWX.vcproj +++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj @@ -85,6 +85,139 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -516,14 +524,6 @@ Optimization="0" /> - - - @@ -532,14 +532,6 @@ Optimization="0" /> - - - diff --git a/Source/Core/DiscIO/Src/FileBlob.cpp b/Source/Core/DiscIO/Src/FileBlob.cpp index 0d14d27a29..87de28a8da 100644 --- a/Source/Core/DiscIO/Src/FileBlob.cpp +++ b/Source/Core/DiscIO/Src/FileBlob.cpp @@ -61,7 +61,7 @@ bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr) if (nbytes >= 0x100000000ULL) return false; // WTF, does windows really have this limitation? - DWORD unused; + DWORD unused = 0; if (!ReadFile(hFile, out_ptr, DWORD(nbytes & 0xFFFFFFFF), &unused, NULL)) return false; else diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp index c728767fd5..bd9eb34dd3 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp @@ -43,7 +43,7 @@ bool CFileSystemGCWii::IsInitialized() const return m_Initialized; } -size_t CFileSystemGCWii::GetFileSize(const char* _rFullPath) const +u64 CFileSystemGCWii::GetFileSize(const char* _rFullPath) const { if (!m_Initialized) return 0; @@ -70,7 +70,7 @@ const char* CFileSystemGCWii::GetFileName(u64 _Address) const return NULL; } -size_t CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const +u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const { if (!m_Initialized) return 0; @@ -170,7 +170,7 @@ bool CFileSystemGCWii::InitFileSystem() } // read the whole FST - u32 FSTOffset = Read32(0x424) << m_OffsetShift; + u64 FSTOffset = (u64)Read32(0x424) << m_OffsetShift; // u32 FSTSize = Read32(0x428); // u32 FSTMaxSize = Read32(0x42C); diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.h b/Source/Core/DiscIO/Src/FileSystemGCWii.h index 78e7bc4ac9..ababa05b86 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.h +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.h @@ -31,9 +31,9 @@ public: CFileSystemGCWii(const IVolume *_rVolume); virtual ~CFileSystemGCWii(); virtual bool IsInitialized() const; - virtual size_t GetFileSize(const char* _rFullPath) const; + virtual u64 GetFileSize(const char* _rFullPath) const; virtual const char* GetFileName(u64 _Address) const; - virtual size_t ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const; + virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const; virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const; virtual bool ExportAllFiles(const char* _rFullPath) const; diff --git a/Source/Core/DiscIO/Src/Filesystem.h b/Source/Core/DiscIO/Src/Filesystem.h index 344d19e86d..aabccfba98 100644 --- a/Source/Core/DiscIO/Src/Filesystem.h +++ b/Source/Core/DiscIO/Src/Filesystem.h @@ -26,9 +26,9 @@ namespace DiscIO // file info of an FST entry struct SFileInfo { - u32 m_NameOffset; + u64 m_NameOffset; u64 m_Offset; - u32 m_FileSize; + u64 m_FileSize; char m_FullPath[512]; bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0 ? true : false; } @@ -51,9 +51,8 @@ public: virtual ~IFileSystem(); virtual bool IsInitialized() const = 0; virtual size_t GetFileList(std::vector &_rFilenames) const = 0; - virtual size_t GetFileSize(const char* _rFullPath) const = 0; - - virtual size_t ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const = 0; + virtual u64 GetFileSize(const char* _rFullPath) const = 0; + virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const = 0; virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const = 0; virtual bool ExportAllFiles(const char* _rFullPath) const = 0; virtual const char* GetFileName(u64 _Address) const = 0;