Some tidy up of sprintf to StringFromFormat
This commit is contained in:
parent
64e01ec763
commit
ebff7974c3
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "CDUtils.h"
|
#include "CDUtils.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
#include <memory> // for std::unique_ptr
|
#include <memory> // for std::unique_ptr
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -150,10 +151,10 @@ static struct
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns true if a device is a block or char device and not a symbolic link
|
// Returns true if a device is a block or char device and not a symbolic link
|
||||||
bool is_device(const char *source_name)
|
bool is_device(const std::string& source_name)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if (0 != lstat(source_name, &buf))
|
if (0 != lstat(source_name.c_str(), &buf))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) &&
|
return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) &&
|
||||||
|
@ -161,17 +162,15 @@ bool is_device(const char *source_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check a device to see if it is a DVD/CD-ROM drive
|
// Check a device to see if it is a DVD/CD-ROM drive
|
||||||
static bool is_cdrom(const char *drive, char *mnttype)
|
static bool is_cdrom(const std::string& drive, char *mnttype)
|
||||||
{
|
{
|
||||||
bool is_cd=false;
|
|
||||||
int cdfd;
|
|
||||||
|
|
||||||
// Check if the device exists
|
// Check if the device exists
|
||||||
if (!is_device(drive))
|
if (!is_device(drive))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
bool is_cd=false;
|
||||||
// If it does exist, verify that it is a cdrom/dvd drive
|
// If it does exist, verify that it is a cdrom/dvd drive
|
||||||
cdfd = open(drive, (O_RDONLY|O_NONBLOCK), 0);
|
int cdfd = open(drive.c_str(), (O_RDONLY|O_NONBLOCK), 0);
|
||||||
if ( cdfd >= 0 )
|
if ( cdfd >= 0 )
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -186,21 +185,16 @@ static bool is_cdrom(const char *drive, char *mnttype)
|
||||||
// Returns a pointer to an array of strings with the device names
|
// Returns a pointer to an array of strings with the device names
|
||||||
std::vector<std::string> cdio_get_devices ()
|
std::vector<std::string> cdio_get_devices ()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
char drive[40];
|
|
||||||
std::vector<std::string> drives;
|
std::vector<std::string> drives;
|
||||||
|
|
||||||
// Scan the system for DVD/CD-ROM drives.
|
// Scan the system for DVD/CD-ROM drives.
|
||||||
for ( i=0; checklist[i].format; ++i )
|
for (unsigned int i = 0; checklist[i].format; ++i)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
|
||||||
for ( j=checklist[i].num_min; j<=checklist[i].num_max; ++j )
|
|
||||||
{
|
{
|
||||||
sprintf(drive, checklist[i].format, j);
|
std::string drive = StringFromFormat(checklist[i].format, j);
|
||||||
if ( (is_cdrom(drive, NULL)) > 0 )
|
if ( (is_cdrom(drive.c_str(), NULL)) > 0 )
|
||||||
{
|
{
|
||||||
std::string str = drive;
|
drives.push_back(std::move(drive));
|
||||||
drives.push_back(str);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,17 +216,5 @@ bool cdio_is_cdrom(std::string device)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<std::string> devices = cdio_get_devices();
|
std::vector<std::string> devices = cdio_get_devices();
|
||||||
bool res = false;
|
return std::find(devices.begin(), devices.end(), device) != devices.end();;
|
||||||
for (auto& odevice : devices)
|
|
||||||
{
|
|
||||||
if (strncmp(odevice.c_str(), device.c_str(), MAX_PATH) == 0)
|
|
||||||
{
|
|
||||||
res = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
devices.clear();
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,10 @@ public:
|
||||||
void SetLines(const char* sectionName, const std::vector<std::string> &lines);
|
void SetLines(const char* sectionName, const std::vector<std::string> &lines);
|
||||||
bool GetLines(const char* sectionName, std::vector<std::string>& lines, const bool remove_comments = true) const;
|
bool GetLines(const char* sectionName, std::vector<std::string>& lines, const bool remove_comments = true) const;
|
||||||
|
|
||||||
|
inline bool DeleteKey(const char* sectionName, const std::string& key)
|
||||||
|
{
|
||||||
|
return DeleteKey(sectionName, key.c_str());
|
||||||
|
}
|
||||||
bool DeleteKey(const char* sectionName, const char* key);
|
bool DeleteKey(const char* sectionName, const char* key);
|
||||||
bool DeleteSection(const char* sectionName);
|
bool DeleteSection(const char* sectionName);
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@ enum LOG_LEVELS
|
||||||
LDEBUG = DEBUG_LEVEL,
|
LDEBUG = DEBUG_LEVEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
||||||
|
|
||||||
#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
|
#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
|
||||||
#define LOGTYPES_TYPE LogTypes::LOG_TYPE
|
#define LOGTYPES_TYPE LogTypes::LOG_TYPE
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,6 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||||
const char *file, int line, const char *format, va_list args)
|
const char *file, int line, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char temp[MAX_MSGLEN];
|
char temp[MAX_MSGLEN];
|
||||||
char msg[MAX_MSGLEN * 2];
|
|
||||||
LogContainer *log = m_Log[type];
|
LogContainer *log = m_Log[type];
|
||||||
|
|
||||||
if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners())
|
if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners())
|
||||||
|
@ -122,15 +121,15 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||||
|
|
||||||
CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);
|
CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);
|
||||||
|
|
||||||
static const char level_to_char[7] = "-NEWID";
|
std::string msg = StringFromFormat("%s %s:%u %c[%s]: %s\n",
|
||||||
sprintf(msg, "%s %s:%u %c[%s]: %s\n",
|
Common::Timer::GetTimeFormatted().c_str(),
|
||||||
Common::Timer::GetTimeFormatted().c_str(),
|
file, line,
|
||||||
file, line, level_to_char[(int)level],
|
LogTypes::LOG_LEVEL_TO_CHAR[(int)level],
|
||||||
log->GetShortName(), temp);
|
log->GetShortName(), temp);
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
Host_SysMessage(msg);
|
Host_SysMessage(msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
log->Trigger(level, msg);
|
log->Trigger(level, msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogManager::Init()
|
void LogManager::Init()
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "MemoryUtil.h"
|
#include "MemoryUtil.h"
|
||||||
#include "MemArena.h"
|
#include "MemArena.h"
|
||||||
|
#include "StringUtil.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -57,20 +58,21 @@ void MemArena::GrabLowMemSpace(size_t size)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char fn[64];
|
|
||||||
for (int i = 0; i < 10000; i++)
|
for (int i = 0; i < 10000; i++)
|
||||||
{
|
{
|
||||||
sprintf(fn, "dolphinmem.%d", i);
|
std::string file_name = StringFromFormat("dolphinmem.%d", i);
|
||||||
fd = shm_open(fn, O_RDWR | O_CREAT | O_EXCL, 0600);
|
fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
shm_unlink(file_name.c_str());
|
||||||
break;
|
break;
|
||||||
if (errno != EEXIST)
|
}
|
||||||
|
else if (errno != EEXIST)
|
||||||
{
|
{
|
||||||
ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno));
|
ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shm_unlink(fn);
|
|
||||||
if (ftruncate(fd, size) < 0)
|
if (ftruncate(fd, size) < 0)
|
||||||
ERROR_LOG(MEMMAP, "Failed to allocate low memory space");
|
ERROR_LOG(MEMMAP, "Failed to allocate low memory space");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,20 +12,16 @@ namespace Common
|
||||||
|
|
||||||
std::string GetTicketFileName(u64 _titleID)
|
std::string GetTicketFileName(u64 _titleID)
|
||||||
{
|
{
|
||||||
char TicketFilename[1024];
|
return StringFromFormat("%sticket/%08x/%08x.tik",
|
||||||
sprintf(TicketFilename, "%sticket/%08x/%08x.tik",
|
File::GetUserPath(D_WIIUSER_IDX).c_str(),
|
||||||
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(_titleID >> 32), (u32)_titleID);
|
(u32)(_titleID >> 32), (u32)_titleID);
|
||||||
|
|
||||||
return TicketFilename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetTitleDataPath(u64 _titleID)
|
std::string GetTitleDataPath(u64 _titleID)
|
||||||
{
|
{
|
||||||
char path[1024];
|
return StringFromFormat("%stitle/%08x/%08x/data/",
|
||||||
sprintf(path, "%stitle/%08x/%08x/data/",
|
File::GetUserPath(D_WIIUSER_IDX).c_str(),
|
||||||
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(_titleID >> 32), (u32)_titleID);
|
(u32)(_titleID >> 32), (u32)_titleID);
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetTMDFileName(u64 _titleID)
|
std::string GetTMDFileName(u64 _titleID)
|
||||||
|
@ -34,11 +30,9 @@ std::string GetTMDFileName(u64 _titleID)
|
||||||
}
|
}
|
||||||
std::string GetTitleContentPath(u64 _titleID)
|
std::string GetTitleContentPath(u64 _titleID)
|
||||||
{
|
{
|
||||||
char ContentPath[1024];
|
return StringFromFormat("%stitle/%08x/%08x/content/",
|
||||||
sprintf(ContentPath, "%stitle/%08x/%08x/content/",
|
File::GetUserPath(D_WIIUSER_IDX).c_str(),
|
||||||
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(_titleID >> 32), (u32)_titleID);
|
(u32)(_titleID >> 32), (u32)_titleID);
|
||||||
|
|
||||||
return ContentPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckTitleTMD(u64 _titleID)
|
bool CheckTitleTMD(u64 _titleID)
|
||||||
|
|
|
@ -167,27 +167,23 @@ u64 Timer::GetLocalTimeSinceJan1970()
|
||||||
std::string Timer::GetTimeFormatted()
|
std::string Timer::GetTimeFormatted()
|
||||||
{
|
{
|
||||||
time_t sysTime;
|
time_t sysTime;
|
||||||
struct tm * gmTime;
|
|
||||||
char formattedTime[13];
|
|
||||||
char tmp[13];
|
|
||||||
|
|
||||||
time(&sysTime);
|
time(&sysTime);
|
||||||
gmTime = localtime(&sysTime);
|
|
||||||
|
struct tm * gmTime = localtime(&sysTime);
|
||||||
|
|
||||||
|
char tmp[13];
|
||||||
strftime(tmp, 6, "%M:%S", gmTime);
|
strftime(tmp, 6, "%M:%S", gmTime);
|
||||||
|
|
||||||
// Now tack on the milliseconds
|
// Now tack on the milliseconds
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct timeb tp;
|
struct timeb tp;
|
||||||
(void)::ftime(&tp);
|
(void)::ftime(&tp);
|
||||||
sprintf(formattedTime, "%s:%03i", tmp, tp.millitm);
|
return StringFromFormat("%s:%03i", tmp, tp.millitm);
|
||||||
#else
|
#else
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
(void)gettimeofday(&t, NULL);
|
(void)gettimeofday(&t, NULL);
|
||||||
sprintf(formattedTime, "%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return std::string(formattedTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a timestamp with decimals for precise time comparisons
|
// Returns a timestamp with decimals for precise time comparisons
|
||||||
|
|
|
@ -151,18 +151,14 @@ void SConfig::SaveSettings()
|
||||||
ini.Get("General", "GCMPathes", &oldPaths, 0);
|
ini.Get("General", "GCMPathes", &oldPaths, 0);
|
||||||
for (int i = numPaths; i < oldPaths; i++)
|
for (int i = numPaths; i < oldPaths; i++)
|
||||||
{
|
{
|
||||||
char tmp[16];
|
ini.DeleteKey("General", StringFromFormat("GCMPath%i", i));
|
||||||
sprintf(tmp, "GCMPath%i", i);
|
|
||||||
ini.DeleteKey("General", tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.Set("General", "GCMPathes", numPaths);
|
ini.Set("General", "GCMPathes", numPaths);
|
||||||
|
|
||||||
for (int i = 0; i < numPaths; i++)
|
for (int i = 0; i < numPaths; i++)
|
||||||
{
|
{
|
||||||
char tmp[16];
|
ini.Set("General", StringFromFormat("GCMPath%i", i).c_str(), m_ISOFolder[i]);
|
||||||
sprintf(tmp, "GCMPath%i", i);
|
|
||||||
ini.Set("General", tmp, m_ISOFolder[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder);
|
ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder);
|
||||||
|
@ -249,13 +245,10 @@ void SConfig::SaveSettings()
|
||||||
ini.Set("Core", "SlotB", m_EXIDevice[1]);
|
ini.Set("Core", "SlotB", m_EXIDevice[1]);
|
||||||
ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
|
ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
|
||||||
ini.Set("Core", "BBA_MAC", m_bba_mac);
|
ini.Set("Core", "BBA_MAC", m_bba_mac);
|
||||||
char sidevicenum[16];
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
sprintf(sidevicenum, "SIDevice%i", i);
|
ini.Set("Core", StringFromFormat("SIDevice%i", i).c_str(), m_SIDevice[i]);
|
||||||
ini.Set("Core", sidevicenum, m_SIDevice[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.Set("Core", "WiiSDCard", m_WiiSDCard);
|
ini.Set("Core", "WiiSDCard", m_WiiSDCard);
|
||||||
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
|
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
|
||||||
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
|
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
|
||||||
|
@ -307,11 +300,9 @@ void SConfig::LoadSettings()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numGCMPaths; i++)
|
for (int i = 0; i < numGCMPaths; i++)
|
||||||
{
|
{
|
||||||
char tmp[16];
|
|
||||||
sprintf(tmp, "GCMPath%i", i);
|
|
||||||
std::string tmpPath;
|
std::string tmpPath;
|
||||||
ini.Get("General", tmp, &tmpPath, "");
|
ini.Get("General", StringFromFormat("GCMPath%i", i).c_str(), &tmpPath, "");
|
||||||
m_ISOFolder.push_back(tmpPath);
|
m_ISOFolder.push_back(std::move(tmpPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,13 +401,10 @@ void SConfig::LoadSettings()
|
||||||
ini.Get("Core", "BBA_MAC", &m_bba_mac);
|
ini.Get("Core", "BBA_MAC", &m_bba_mac);
|
||||||
ini.Get("Core", "TimeProfiling",&m_LocalCoreStartupParameter.bJITILTimeProfiling, false);
|
ini.Get("Core", "TimeProfiling",&m_LocalCoreStartupParameter.bJITILTimeProfiling, false);
|
||||||
ini.Get("Core", "OutputIR", &m_LocalCoreStartupParameter.bJITILOutputIR, false);
|
ini.Get("Core", "OutputIR", &m_LocalCoreStartupParameter.bJITILOutputIR, false);
|
||||||
char sidevicenum[16];
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
sprintf(sidevicenum, "SIDevice%i", i);
|
ini.Get("Core", StringFromFormat("SIDevice%i", i).c_str(), (u32*)&m_SIDevice[i], (i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE);
|
||||||
ini.Get("Core", sidevicenum, (u32*)&m_SIDevice[i], (i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
|
ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
|
||||||
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
|
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
|
||||||
ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
|
ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
|
||||||
|
|
|
@ -110,8 +110,6 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
|
||||||
// Pad with nops to 32byte boundary
|
// Pad with nops to 32byte boundary
|
||||||
while (code_padded.size() & 0x7f)
|
while (code_padded.size() & 0x7f)
|
||||||
code_padded.push_back(0);
|
code_padded.push_back(0);
|
||||||
|
|
||||||
char buffer[1024];
|
|
||||||
header.clear();
|
header.clear();
|
||||||
header.reserve(code_padded.size() * 4);
|
header.reserve(code_padded.size() * 4);
|
||||||
header.append("#define NUM_UCODES 1\n\n");
|
header.append("#define NUM_UCODES 1\n\n");
|
||||||
|
@ -125,8 +123,7 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
|
||||||
{
|
{
|
||||||
if (j && ((j & 15) == 0))
|
if (j && ((j & 15) == 0))
|
||||||
header.append("\n\t\t");
|
header.append("\n\t\t");
|
||||||
sprintf(buffer, "0x%04x, ", code_padded[j]);
|
header.append(StringFromFormat("0x%04x, ", code_padded[j]));
|
||||||
header.append(buffer);
|
|
||||||
}
|
}
|
||||||
header.append("\n\t},\n");
|
header.append("\n\t},\n");
|
||||||
|
|
||||||
|
@ -137,7 +134,6 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||||
u32 numCodes, const char *name, std::string &header)
|
u32 numCodes, const char *name, std::string &header)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<u16> > codes_padded;
|
std::vector<std::vector<u16> > codes_padded;
|
||||||
char buffer[1024];
|
|
||||||
u32 reserveSize = 0;
|
u32 reserveSize = 0;
|
||||||
for(u32 i = 0; i < numCodes; i++)
|
for(u32 i = 0; i < numCodes; i++)
|
||||||
{
|
{
|
||||||
|
@ -148,20 +144,16 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||||
|
|
||||||
reserveSize += (u32)codes_padded.at(i).size();
|
reserveSize += (u32)codes_padded.at(i).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
header.clear();
|
header.clear();
|
||||||
header.reserve(reserveSize * 4);
|
header.reserve(reserveSize * 4);
|
||||||
sprintf(buffer, "#define NUM_UCODES %u\n\n", numCodes);
|
header.append(StringFromFormat("#define NUM_UCODES %u\n\n", numCodes));
|
||||||
header.append(buffer);
|
|
||||||
header.append("const char* UCODE_NAMES[NUM_UCODES] = {\n");
|
header.append("const char* UCODE_NAMES[NUM_UCODES] = {\n");
|
||||||
for (u32 i = 0; i < numCodes; i++)
|
for (u32 i = 0; i < numCodes; i++)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (! SplitPath(filenames->at(i), NULL, &filename, NULL))
|
if (! SplitPath(filenames->at(i), NULL, &filename, NULL))
|
||||||
filename = filenames->at(i);
|
filename = filenames->at(i);
|
||||||
sprintf(buffer, "\t\"%s\",\n", filename.c_str());
|
header.append(StringFromFormat("\t\"%s\",\n", filename.c_str()));
|
||||||
header.append(buffer);
|
|
||||||
}
|
}
|
||||||
header.append("};\n\n");
|
header.append("};\n\n");
|
||||||
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
|
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
|
||||||
|
@ -176,8 +168,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||||
{
|
{
|
||||||
if (j && ((j & 15) == 0))
|
if (j && ((j & 15) == 0))
|
||||||
header.append("\n\t\t");
|
header.append("\n\t\t");
|
||||||
sprintf(buffer, "0x%04x, ", codes_padded.at(i).at(j));
|
header.append(StringFromFormat("0x%04x, ", codes_padded.at(i).at(j)));
|
||||||
header.append(buffer);
|
|
||||||
}
|
}
|
||||||
header.append("\n\t},\n");
|
header.append("\n\t},\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,7 @@ void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const ch
|
||||||
std::string Temp;
|
std::string Temp;
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
char Buffer[128];
|
Temp.append(StringFromFormat("%02x ", _pData[j++]));
|
||||||
sprintf(Buffer, "%02x ", _pData[j++]);
|
|
||||||
Temp.append(Buffer);
|
|
||||||
|
|
||||||
if (j >= _Size)
|
if (j >= _Size)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -192,9 +192,7 @@ protected:
|
||||||
std::string Temp;
|
std::string Temp;
|
||||||
for (u32 j = 0; j < InBufferSize; j++)
|
for (u32 j = 0; j < InBufferSize; j++)
|
||||||
{
|
{
|
||||||
char Buffer[128];
|
Temp += StringFromFormat("%02x ", Memory::Read_U8(InBuffer+j));
|
||||||
sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j));
|
|
||||||
Temp.append(Buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GENERIC_LOG(LogType, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str());
|
GENERIC_LOG(LogType, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str());
|
||||||
|
|
|
@ -54,9 +54,7 @@ std::string CVolumeGC::GetUniqueID() const
|
||||||
|
|
||||||
std::string CVolumeGC::GetRevisionSpecificUniqueID() const
|
std::string CVolumeGC::GetRevisionSpecificUniqueID() const
|
||||||
{
|
{
|
||||||
char rev[16];
|
return GetUniqueID() + StringFromFormat("r%d", GetRevision());
|
||||||
sprintf(rev, "r%d", GetRevision());
|
|
||||||
return GetUniqueID() + rev;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IVolume::ECountry CVolumeGC::GetCountry() const
|
IVolume::ECountry CVolumeGC::GetCountry() const
|
||||||
|
|
|
@ -600,9 +600,10 @@ void VertexLoader::CompileVertexTranslator()
|
||||||
|
|
||||||
if (pFunc == 0)
|
if (pFunc == 0)
|
||||||
{
|
{
|
||||||
char temp[256];
|
Host_SysMessage(
|
||||||
sprintf(temp,"%i %i %i %i", m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3);
|
StringFromFormat("VertexLoader_Normal::GetFunction(%i %i %i %i) returned zero!",
|
||||||
Host_SysMessage("VertexLoader_Normal::GetFunction returned zero!");
|
m_VtxDesc.Normal, m_VtxAttr.NormalFormat,
|
||||||
|
m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3).c_str());
|
||||||
}
|
}
|
||||||
WriteCall(pFunc);
|
WriteCall(pFunc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue