mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 12:35:27 +00:00
fixed crash on linux, added DISCIO logging type, some extra logging messages and some logging cleanup
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2533 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9ef42aefac
commit
e9430a0252
@ -174,6 +174,11 @@ bool CreateFullPath(const char *fullPath)
|
|||||||
int panicCounter = 100;
|
int panicCounter = 100;
|
||||||
INFO_LOG(COMMON, "CreateFullPath: path %s\n", fullPath);
|
INFO_LOG(COMMON, "CreateFullPath: path %s\n", fullPath);
|
||||||
|
|
||||||
|
if (File::Exists(fullPath)) {
|
||||||
|
INFO_LOG(COMMON, "CreateFullPath: path exists %s\n", fullPath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const char *position = fullPath;
|
const char *position = fullPath;
|
||||||
while (true) {
|
while (true) {
|
||||||
// Find next sub path, support both \ and / directory separators
|
// Find next sub path, support both \ and / directory separators
|
||||||
@ -329,6 +334,7 @@ u64 GetSize(const char *filename)
|
|||||||
// on windows it's actually _stat64 defined in commonFuncs
|
// on windows it's actually _stat64 defined in commonFuncs
|
||||||
struct stat64 buf;
|
struct stat64 buf;
|
||||||
if (stat64(filename, &buf) == 0) {
|
if (stat64(filename, &buf) == 0) {
|
||||||
|
DEBUG_LOG(COMMON, "GetSize: %s: %d", filename, buf.st_size);
|
||||||
return buf.st_size;
|
return buf.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ enum LOG_TYPE {
|
|||||||
COMMANDPROCESSOR,
|
COMMANDPROCESSOR,
|
||||||
COMMON,
|
COMMON,
|
||||||
CONSOLE,
|
CONSOLE,
|
||||||
|
DISCIO,
|
||||||
DSPHLE,
|
DSPHLE,
|
||||||
DSPINTERFACE,
|
DSPINTERFACE,
|
||||||
DVDINTERFACE,
|
DVDINTERFACE,
|
||||||
@ -60,10 +61,10 @@ enum LOG_TYPE {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum LOG_LEVELS {
|
enum LOG_LEVELS {
|
||||||
LERROR, // Bad errors - that still don't deserve a PanicAlert.
|
LERROR = 0, // Bad errors - that still don't deserve a PanicAlert.
|
||||||
LWARNING, // Something is suspicious.
|
LWARNING, // Something is suspicious.
|
||||||
LINFO, // General information.
|
LINFO, // General information.
|
||||||
LDEBUG, // Strictly for detailed debugging - might make things slow.
|
LDEBUG, // Strictly for detailed debugging - might make things slow.
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -71,44 +72,22 @@ enum LOG_LEVELS {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
FIXME:
|
FIXME:
|
||||||
- How can generic_log support log levels in compile time?
|
- Debug_run() - run only in debug time
|
||||||
Maybe it should call ERROR/.. according to level instead of the other way around.
|
|
||||||
- Check if we can make the win32 and gcc togther (get rid of those ##)
|
|
||||||
- Compile the log functions according to LOGLEVEL
|
- Compile the log functions according to LOGLEVEL
|
||||||
*/
|
*/
|
||||||
#ifdef LOGGING
|
#ifdef LOGGING
|
||||||
#define LOGLEVEL 4
|
#define LOGLEVEL 5
|
||||||
|
|
||||||
extern void __Log(int logNumber, const char* text, ...);
|
extern void __Log(int logNumber, const char* text, ...);
|
||||||
//extern void __Logv(int log, int v, const char *format, ...);
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
/* #define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); */
|
|
||||||
/* #define LOGV(t, v, ...) __Log(LogTypes::t + (v)*100, __VA_ARGS__); */
|
|
||||||
/* #define LOGP(t, ...) __Log(t, __VA_ARGS__); */
|
|
||||||
/* #define LOGVP(t, v, ...) __Log(t + (v)*100, __VA_ARGS__); */
|
|
||||||
|
|
||||||
|
|
||||||
|
// Let the compiler optimize this out
|
||||||
|
//#define GENERIC_LOG(t,v, ...) {if (v <= LOGLEVEL) __Log(t + (v)*100, __VA_ARGS__);}
|
||||||
#define GENERIC_LOG(t,v, ...) {__Log(t + (v)*100, __VA_ARGS__);}
|
#define GENERIC_LOG(t,v, ...) {__Log(t + (v)*100, __VA_ARGS__);}
|
||||||
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)}
|
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)}
|
||||||
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)}
|
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)}
|
||||||
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)}
|
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)}
|
||||||
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)}
|
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
//#define LOG(t, ...) __Log(LogTypes::t, ##__VA_ARGS__);
|
|
||||||
//#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, ##__VA_ARGS__);
|
|
||||||
//#define LOGP(t, ...) __Log(t, ##__VA_ARGS__);
|
|
||||||
//#define LOGVP(t,v, ...) __Log(t + (v)*100, ##__VA_ARGS__);
|
|
||||||
#define GENERIC_LOG(t,v, ...) {__Log(t + (v)*100, ##__VA_ARGS__);}
|
|
||||||
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, ##__VA_ARGS__)}
|
|
||||||
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, ##__VA_ARGS__)}
|
|
||||||
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, ##__VA_ARGS__)}
|
|
||||||
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, ##__VA_ARGS__)}
|
|
||||||
|
|
||||||
#endif // WIN32
|
|
||||||
|
|
||||||
#define _dbg_assert_(_t_, _a_) \
|
#define _dbg_assert_(_t_, _a_) \
|
||||||
if (!(_a_)) {\
|
if (!(_a_)) {\
|
||||||
@ -124,11 +103,7 @@ extern void __Log(int logNumber, const char* text, ...);
|
|||||||
#define _dbg_update_() Host_UpdateLogDisplay();
|
#define _dbg_update_() Host_UpdateLogDisplay();
|
||||||
|
|
||||||
#else // no logging
|
#else // no logging
|
||||||
|
#define LOGLEVEL 1
|
||||||
//#define LOG(_t_, ...)
|
|
||||||
//#define LOGV(_t_, _v_, ...)
|
|
||||||
//#define LOGP(_t_, ...)
|
|
||||||
//#define LOGVP(_t_, _v_, ...)
|
|
||||||
|
|
||||||
#define _dbg_clear_()
|
#define _dbg_clear_()
|
||||||
#define _dbg_update_() ;
|
#define _dbg_update_() ;
|
||||||
|
@ -121,6 +121,7 @@ void LogManager::Init()
|
|||||||
{
|
{
|
||||||
m_Log[LogTypes::MASTER_LOG + i*100] = new CDebugger_Log("*", "Master Log", i);
|
m_Log[LogTypes::MASTER_LOG + i*100] = new CDebugger_Log("*", "Master Log", i);
|
||||||
m_Log[LogTypes::COMMON + i*100] = new CDebugger_Log("COMMON", "Common Lib", i);
|
m_Log[LogTypes::COMMON + i*100] = new CDebugger_Log("COMMON", "Common Lib", i);
|
||||||
|
m_Log[LogTypes::DISCIO + i*100] = new CDebugger_Log("DISCIO", "Disc IO", i);
|
||||||
m_Log[LogTypes::BOOT + i*100] = new CDebugger_Log("BOOT", "Boot", i);
|
m_Log[LogTypes::BOOT + i*100] = new CDebugger_Log("BOOT", "Boot", i);
|
||||||
m_Log[LogTypes::PIXELENGINE + i*100] = new CDebugger_Log("PE", "PixelEngine", i);
|
m_Log[LogTypes::PIXELENGINE + i*100] = new CDebugger_Log("PE", "PixelEngine", i);
|
||||||
m_Log[LogTypes::COMMANDPROCESSOR + i*100] = new CDebugger_Log("CP", "CommandProc", i);
|
m_Log[LogTypes::COMMANDPROCESSOR + i*100] = new CDebugger_Log("CP", "CommandProc", i);
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "NANDContentLoader.h"
|
#include "NANDContentLoader.h"
|
||||||
|
|
||||||
|
|
||||||
#include "AES/aes.h"
|
#include "AES/aes.h"
|
||||||
#include "MathUtil.h"
|
#include "MathUtil.h"
|
||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
@ -97,12 +97,14 @@ bool CNANDContentLoader::CreateFromWAD(const std::string& _rName)
|
|||||||
bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
||||||
{
|
{
|
||||||
std::string TMDFileName(_rPath);
|
std::string TMDFileName(_rPath);
|
||||||
TMDFileName += "/title.tmd";
|
TMDFileName += "/title.tmd";
|
||||||
|
|
||||||
FILE* pTMDFile = fopen(TMDFileName.c_str(), "rb");
|
FILE* pTMDFile = fopen(TMDFileName.c_str(), "rb");
|
||||||
if (pTMDFile == NULL)
|
if (pTMDFile == NULL) {
|
||||||
|
ERROR_LOG(DISCIO, "CreateFromDirectory: error opening %s",
|
||||||
|
TMDFileName.c_str());
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
u64 Size = File::GetSize(TMDFileName.c_str());
|
u64 Size = File::GetSize(TMDFileName.c_str());
|
||||||
u8* pTMD = new u8[Size];
|
u8* pTMD = new u8[Size];
|
||||||
fread(pTMD, Size, 1, pTMDFile);
|
fread(pTMD, Size, 1, pTMDFile);
|
||||||
@ -126,7 +128,7 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
|||||||
rContent.m_pData = NULL;
|
rContent.m_pData = NULL;
|
||||||
|
|
||||||
char szFilename[1024];
|
char szFilename[1024];
|
||||||
sprintf(szFilename, "%s\\%08x.app", _rPath.c_str(), rContent.m_ContentID);
|
sprintf(szFilename, "%s/%08x.app", _rPath.c_str(), rContent.m_ContentID);
|
||||||
|
|
||||||
FILE* pFile = fopen(szFilename, "rb");
|
FILE* pFile = fopen(szFilename, "rb");
|
||||||
// i have seen TMDs which index to app which doesn't exist...
|
// i have seen TMDs which index to app which doesn't exist...
|
||||||
@ -139,7 +141,11 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
|||||||
|
|
||||||
fread(rContent.m_pData, Size, 1, pFile);
|
fread(rContent.m_pData, Size, 1, pFile);
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
}
|
} else {
|
||||||
|
ERROR_LOG(DISCIO, "CreateFromDirectory: error opening %s",
|
||||||
|
szFilename);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -191,6 +197,7 @@ u8* CNANDContentLoader::CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size,
|
|||||||
|
|
||||||
if (!_rReader.Read(_Offset, _Size, pTmpBuffer))
|
if (!_rReader.Read(_Offset, _Size, pTmpBuffer))
|
||||||
{
|
{
|
||||||
|
ERROR_LOG(DISCIO, "WiiWAD: Could not read from file");
|
||||||
PanicAlert("WiiWAD: Could not read from file");
|
PanicAlert("WiiWAD: Could not read from file");
|
||||||
}
|
}
|
||||||
return pTmpBuffer;
|
return pTmpBuffer;
|
||||||
@ -233,7 +240,7 @@ bool CNANDContentLoader::ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u
|
|||||||
|
|
||||||
u32 RoundedSize = ROUND_UP(rContent.m_Size, 0x40);
|
u32 RoundedSize = ROUND_UP(rContent.m_Size, 0x40);
|
||||||
rContent.m_pData = new u8[RoundedSize];
|
rContent.m_pData = new u8[RoundedSize];
|
||||||
|
|
||||||
memset(IV, 0, sizeof IV);
|
memset(IV, 0, sizeof IV);
|
||||||
memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2);
|
memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2);
|
||||||
AESDecode(DecryptTitleKey, IV, p, RoundedSize, rContent.m_pData);
|
AESDecode(DecryptTitleKey, IV, p, RoundedSize, rContent.m_pData);
|
||||||
@ -283,4 +290,7 @@ bool CNANDContentLoader::ParseWAD(DiscIO::IBlobReader& _rReader)
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user