Skip to content

Commit

Permalink
Added proper casts and variable changes to SPU
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdbeardgame committed Dec 17, 2020
1 parent ce62de0 commit 90f5f50
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions pcsx2/SPU2/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ extern void ConLog(const char* fmt, ...);

extern void DoFullDump();

extern FILE* OpenBinaryLog(const wxString& logfile);
extern FILE* OpenLog(const wxString& logfile);
extern FILE* OpenDump(const wxString& logfile);
extern FILE* OpenBinaryLog(const std::string& logfile);
extern FILE* OpenLog(const std::string& logfile);
extern FILE* OpenDump(const std::string& logfile);

namespace WaveDump
{
Expand Down
10 changes: 5 additions & 5 deletions pcsx2/SPU2/Dma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ void DMALogOpen()
{
if (!DMALog())
return;
DMA4LogFile = OpenBinaryLog(DMA4LogFileName);
DMA7LogFile = OpenBinaryLog(DMA7LogFileName);
ADMA4LogFile = OpenBinaryLog(L"adma4.raw");
ADMA7LogFile = OpenBinaryLog(L"adma7.raw");
ADMAOutLogFile = OpenBinaryLog(L"admaOut.raw");
DMA4LogFile = OpenBinaryLog(DMA4LogFileName.ToStdString());
DMA7LogFile = OpenBinaryLog(DMA7LogFileName.ToStdString());
ADMA4LogFile = OpenBinaryLog("adma4.raw");
ADMA7LogFile = OpenBinaryLog("adma7.raw");
ADMAOutLogFile = OpenBinaryLog("admaOut.raw");
}

void DMA4LogWrite(void* lpData, u32 ulSize)
Expand Down
4 changes: 2 additions & 2 deletions pcsx2/SPU2/Linux/CfgHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void initIni()
{
if (!pathSet)
{
path = GetSettingsFolder().Combine(path).GetFullPath();
path = Path::Combine(GetSettingsFolder().string(), path.ToStdString());
pathSet = true;
}
if (spuConfig == nullptr)
Expand All @@ -42,7 +42,7 @@ void setIni(const wchar_t* Section)
void CfgSetSettingsDir(const char* dir)
{
FileLog("CfgSetSettingsDir(%s)\n", dir);
path = Path::Combine((dir == nullptr) ? wxString(L"inis") : wxString::FromUTF8(dir), L"SPU2.ini");
path = Path::Combine((dir == nullptr) ? "inis" : std::string(dir), "SPU2.ini");
pathSet = true;
}

Expand Down
12 changes: 6 additions & 6 deletions pcsx2/SPU2/Linux/ConfigDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "../Global.h"
#include "Dialogs.h"
#include "Config.h"
#include "Utilities/Path.h"
#include "Utilities/PathUtils.h"

bool DebugEnabled = false;
bool _MsgToConsole = false;
Expand All @@ -40,8 +40,8 @@ bool _RegDump = false;
// the configured crap in the ini file.
static bool LogLocationSetByPcsx2 = false;

static wxDirName LogsFolder;
static wxDirName DumpsFolder;
static std::string LogsFolder;
static std::string DumpsFolder;

wxString AccessLogFileName;
wxString WaveLogFileName;
Expand All @@ -59,17 +59,17 @@ void CfgSetLogDir(const char* dir)
LogLocationSetByPcsx2 = (dir != nullptr);
}

FILE* OpenBinaryLog(const wxString& logfile)
FILE* OpenBinaryLog(const std::string& logfile)
{
return wxFopen(Path::Combine(LogsFolder, logfile), L"wb");
}

FILE* OpenLog(const wxString& logfile)
FILE* OpenLog(const std::string& logfile)
{
return wxFopen(Path::Combine(LogsFolder, logfile), L"w");
}

FILE* OpenDump(const wxString& logfile)
FILE* OpenDump(const std::string& logfile)
{
return wxFopen(Path::Combine(DumpsFolder, logfile), L"w");
}
Expand Down
28 changes: 14 additions & 14 deletions pcsx2/SPU2/Windows/CfgHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ void SysMessage(const wchar_t* fmt, ...)

//////

#include "Utilities/Path.h"
#include "Utilities/PathUtils.h"

wxString CfgFile(L"SPU2.ini");
std::string CfgFile("SPU2.ini");
bool pathSet = false;

void initIni()
{
if (!pathSet)
{
CfgFile = GetSettingsFolder().Combine(CfgFile).GetFullPath();
CfgFile = Path::Combine(GetSettingsFolder().string(), CfgFile);
pathSet = true;
}
}
Expand All @@ -69,7 +69,7 @@ void CfgSetSettingsDir(const char* dir)
}


/*| Config File Format: |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*\
/*| Config File Format: |����������������������*\
+--+---------------------+------------------------+
| |
| Option=Value |
Expand All @@ -88,23 +88,23 @@ void CfgWriteBool(const TCHAR* Section, const TCHAR* Name, bool Value)
{
initIni();
const TCHAR* Data = Value ? L"TRUE" : L"FALSE";
WritePrivateProfileString(Section, Name, Data, CfgFile);
WritePrivateProfileString(Section, Name, Data, wxString(CfgFile));
}

void CfgWriteInt(const TCHAR* Section, const TCHAR* Name, int Value)
{
initIni();
TCHAR Data[32];
_itow(Value, Data, 10);
WritePrivateProfileString(Section, Name, Data, CfgFile);
WritePrivateProfileString(Section, Name, Data, wxString(CfgFile));
}

void CfgWriteFloat(const TCHAR* Section, const TCHAR* Name, float Value)
{
initIni();
TCHAR Data[32];
_swprintf(Data, L"%f", Value);
WritePrivateProfileString(Section, Name, Data, CfgFile);
WritePrivateProfileString(Section, Name, Data, wxString(CfgFile));
}

/*void CfgWriteStr(const TCHAR* Section, const TCHAR* Name, const TCHAR *Data)
Expand All @@ -115,7 +115,7 @@ WritePrivateProfileString( Section, Name, Data, CfgFile );
void CfgWriteStr(const TCHAR* Section, const TCHAR* Name, const wxString& Data)
{
initIni();
WritePrivateProfileString(Section, Name, Data, CfgFile);
WritePrivateProfileString(Section, Name, Data, wxString(CfgFile));
}

/*****************************************************************************/
Expand All @@ -125,7 +125,7 @@ bool CfgReadBool(const TCHAR* Section, const TCHAR* Name, bool Default)
initIni();
TCHAR Data[255] = {0};

GetPrivateProfileString(Section, Name, L"", Data, 255, CfgFile);
GetPrivateProfileString(Section, Name, L"", Data, 255, wxString(CfgFile));
Data[254] = 0;
if (wcslen(Data) == 0)
{
Expand All @@ -151,7 +151,7 @@ int CfgReadInt(const TCHAR* Section, const TCHAR* Name, int Default)
{
initIni();
TCHAR Data[255] = {0};
GetPrivateProfileString(Section, Name, L"", Data, 255, CfgFile);
GetPrivateProfileString(Section, Name, L"", Data, 255, wxString(CfgFile));
Data[254] = 0;

if (wcslen(Data) == 0)
Expand All @@ -167,7 +167,7 @@ float CfgReadFloat(const TCHAR* Section, const TCHAR* Name, float Default)
{
initIni();
TCHAR Data[255] = {0};
GetPrivateProfileString(Section, Name, L"", Data, 255, CfgFile);
GetPrivateProfileString(Section, Name, L"", Data, 255, wxString(CfgFile));
Data[254] = 0;

if (wcslen(Data) == 0)
Expand All @@ -182,7 +182,7 @@ float CfgReadFloat(const TCHAR* Section, const TCHAR* Name, float Default)
void CfgReadStr(const TCHAR* Section, const TCHAR* Name, TCHAR* Data, int DataSize, const TCHAR* Default)
{
initIni();
GetPrivateProfileString(Section, Name, L"", Data, DataSize, CfgFile);
GetPrivateProfileString(Section, Name, L"", Data, DataSize, wxString(CfgFile));

if (wcslen(Data) == 0)
{
Expand All @@ -195,7 +195,7 @@ void CfgReadStr(const TCHAR* Section, const TCHAR* Name, wxString& Data, const T
{
initIni();
wchar_t workspace[512];
GetPrivateProfileString(Section, Name, L"", workspace, ArraySize(workspace), CfgFile);
GetPrivateProfileString(Section, Name, L"", workspace, ArraySize(workspace), wxString(CfgFile));

Data = workspace;

Expand All @@ -213,7 +213,7 @@ bool CfgFindName(const TCHAR* Section, const TCHAR* Name)
initIni();
// Only load 24 characters. No need to load more.
TCHAR Data[24] = {0};
GetPrivateProfileString(Section, Name, L"", Data, 24, CfgFile);
GetPrivateProfileString(Section, Name, L"", Data, 24, wxString(CfgFile));
Data[23] = 0;

if (wcslen(Data) == 0)
Expand Down
26 changes: 13 additions & 13 deletions pcsx2/SPU2/Windows/ConfigDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "PrecompiledHeader.h"
#include "../Global.h"
#include "Dialogs.h"
#include "Utilities\Path.h"
#include "Utilities\PathUtils.h"


bool DebugEnabled = false;
Expand Down Expand Up @@ -45,8 +45,8 @@ static bool LogLocationSetByPcsx2 = false;
static wxString CfgLogsFolder;
static wxString CfgDumpsFolder;

static wxDirName LogsFolder;
static wxDirName DumpsFolder;
static fs::path LogsFolder;
static fs::path DumpsFolder;

wxString AccessLogFileName;
wxString DMA4LogFileName;
Expand All @@ -58,24 +58,24 @@ wxString RegDumpFileName;

void CfgSetLogDir(const char* dir)
{
LogsFolder = (dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile);
DumpsFolder = (dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile);
LogsFolder.string() = ((dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile)).ToStdString();
DumpsFolder.string() = ((dir == nullptr) ? wxString(L"logs") : wxString(dir, wxConvFile)).ToStdString();
LogLocationSetByPcsx2 = (dir != nullptr);
}

FILE* OpenBinaryLog(const wxString& logfile)
FILE* OpenBinaryLog(const std::string& logfile)
{
return wxFopen(Path::Combine(LogsFolder, logfile), L"wb");
return wxFopen(Path::Combine(LogsFolder.string(), logfile), L"wb");
}

FILE* OpenLog(const wxString& logfile)
FILE* OpenLog(const std::string& logfile)
{
return wxFopen(Path::Combine(LogsFolder, logfile), L"w");
return wxFopen(Path::Combine(LogsFolder.string(), logfile), L"w");
}

FILE* OpenDump(const wxString& logfile)
FILE* OpenDump(const std::string& logfile)
{
return wxFopen(Path::Combine(DumpsFolder, logfile), L"w");
return wxFopen(Path::Combine(DumpsFolder.string(), logfile), L"w");
}

namespace DebugConfig
Expand Down Expand Up @@ -117,8 +117,8 @@ namespace DebugConfig

if (!LogLocationSetByPcsx2)
{
LogsFolder = CfgLogsFolder;
DumpsFolder = CfgLogsFolder;
LogsFolder = CfgLogsFolder.ToStdString();
DumpsFolder = CfgLogsFolder.ToStdString();
}
}

Expand Down
2 changes: 1 addition & 1 deletion pcsx2/SPU2/spu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ s32 SPU2init()
#ifdef SPU2_LOG
if (AccessLog())
{
spu2Log = OpenLog(AccessLogFileName);
spu2Log = OpenLog(AccessLogFileName.ToStdString());
setvbuf(spu2Log, nullptr, _IONBF, 0);
FileLog("SPU2init\n");
}
Expand Down

0 comments on commit 90f5f50

Please sign in to comment.