Merge branch 'audetto-strings'

This commit is contained in:
tomcw 2019-09-15 20:45:50 +01:00
commit d2a5a6e829
36 changed files with 317 additions and 348 deletions

View file

@ -66,7 +66,7 @@ static UINT16 g_AppleWinVersion[4] = {0};
static UINT16 g_OldAppleWinVersion[4] = {0};
TCHAR VERSIONSTRING[VERSIONSTRING_SIZE] = "xx.yy.zz.ww";
const TCHAR *g_pAppTitle = NULL;
std::string g_pAppTitle;
eApple2Type g_Apple2Type = A2TYPE_APPLE2EENHANCED;
@ -80,15 +80,15 @@ HINSTANCE g_hInstance = (HINSTANCE)0;
AppMode_e g_nAppMode = MODE_LOGO;
static bool g_bLoadedSaveState = false;
TCHAR g_sProgramDir[MAX_PATH] = TEXT(""); // Directory of where AppleWin executable resides
TCHAR g_sDebugDir [MAX_PATH] = TEXT(""); // TODO: Not currently used
TCHAR g_sScreenShotDir[MAX_PATH] = TEXT(""); // TODO: Not currently used
std::string g_sProgramDir; // Directory of where AppleWin executable resides
std::string g_sDebugDir; // TODO: Not currently used
std::string g_sScreenShotDir; // TODO: Not currently used
bool g_bCapturePrintScreenKey = true;
static bool g_bHookSystemKey = true;
static bool g_bHookAltTab = false;
static bool g_bHookAltGrControl = false;
TCHAR g_sCurrentDir[MAX_PATH] = TEXT(""); // Also Starting Dir. Debugger uses this when load/save
std::string g_sCurrentDir; // Also Starting Dir. Debugger uses this when load/save
bool g_bRestart = false;
bool g_bRestartFullScreen = false;
@ -478,15 +478,18 @@ void EnterMessageLoop(void)
//===========================================================================
void GetProgramDirectory(void)
{
GetModuleFileName((HINSTANCE)0, g_sProgramDir, MAX_PATH);
g_sProgramDir[MAX_PATH-1] = 0;
TCHAR programDir[MAX_PATH];
GetModuleFileName((HINSTANCE)0, programDir, MAX_PATH);
programDir[MAX_PATH-1] = 0;
int loop = _tcslen(g_sProgramDir);
g_sProgramDir = programDir;
int loop = g_sProgramDir.size();
while (loop--)
{
if ((g_sProgramDir[loop] == TEXT('\\')) || (g_sProgramDir[loop] == TEXT(':')))
{
g_sProgramDir[loop+1] = 0;
g_sProgramDir.resize(loop + 1); // this reduces the size
break;
}
}
@ -753,18 +756,18 @@ void LoadConfiguration(void)
//===========================================================================
bool SetCurrentImageDir(const char* pszImageDir)
bool SetCurrentImageDir(const std::string & pszImageDir)
{
strcpy(g_sCurrentDir, pszImageDir);
g_sCurrentDir = pszImageDir;
int nLen = strlen( g_sCurrentDir );
int nLen = g_sCurrentDir.size();
if ((nLen > 0) && (g_sCurrentDir[ nLen - 1 ] != '\\'))
{
g_sCurrentDir[ nLen + 0 ] = '\\';
g_sCurrentDir[ nLen + 1 ] = 0;
g_sCurrentDir.resize(nLen + 1);
}
if( SetCurrentDirectory(g_sCurrentDir) )
if( SetCurrentDirectory(g_sCurrentDir.c_str()) )
return true;
return false;
@ -1705,8 +1708,8 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
int nIdx = strPathname.find_last_of('\\');
if (nIdx >= 0 && nIdx+1 < (int)strPathname.length())
{
std::string strPath = strPathname.substr(0, nIdx+1);
SetCurrentImageDir(strPath.c_str());
const std::string strPath = strPathname.substr(0, nIdx+1);
SetCurrentImageDir(strPath);
}
// Override value just loaded from Registry by LoadConfiguration()

View file

@ -6,12 +6,12 @@
void LogFileTimeUntilFirstKeyReadReset(void);
void LogFileTimeUntilFirstKeyRead(void);
bool SetCurrentImageDir(const char* pszImageDir);
bool SetCurrentImageDir(const std::string & pszImageDir);
extern const UINT16* GetOldAppleWinVersion(void);
extern TCHAR VERSIONSTRING[]; // Constructed in WinMain()
extern const TCHAR *g_pAppTitle;
extern std::string g_pAppTitle;
extern eApple2Type g_Apple2Type;
eApple2Type GetApple2Type(void);
@ -34,8 +34,8 @@ bool GetLoadedSaveStateFlag(void);
void SetLoadedSaveStateFlag(const bool bFlag);
bool GetHookAltGrControl(void);
extern TCHAR g_sProgramDir[MAX_PATH];
extern TCHAR g_sCurrentDir[MAX_PATH];
extern std::string g_sProgramDir;
extern std::string g_sCurrentDir;
extern bool g_bRestart;
extern bool g_bRestartFullScreen;

View file

@ -85,7 +85,7 @@ BOOL CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
break;
case IDC_SAVESTATE_BROWSE:
if(m_PropertySheetHelper.SaveStateSelectImage(hWnd, TEXT("Select Save State file"), true))
SendDlgItemMessage(hWnd, IDC_SAVESTATE_FILENAME, WM_SETTEXT, 0, (LPARAM)m_PropertySheetHelper.GetSSNewFilename());
SendDlgItemMessage(hWnd, IDC_SAVESTATE_FILENAME, WM_SETTEXT, 0, (LPARAM)m_PropertySheetHelper.GetSSNewFilename().c_str());
break;
case IDC_PRINTER_DUMP_FILENAME_BROWSE:
{
@ -125,7 +125,7 @@ BOOL CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
case WM_INITDIALOG:
{
SendDlgItemMessage(hWnd,IDC_SAVESTATE_FILENAME,WM_SETTEXT,0,(LPARAM)Snapshot_GetFilename());
SendDlgItemMessage(hWnd,IDC_SAVESTATE_FILENAME,WM_SETTEXT,0,(LPARAM)Snapshot_GetFilename().c_str());
CheckDlgButton(hWnd, IDC_SAVESTATE_ON_EXIT, g_bSaveStateOnExit ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_DUMPTOPRINTER, g_bDumpToPrinter ? BST_CHECKED : BST_UNCHECKED);
@ -134,7 +134,7 @@ BOOL CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
CheckDlgButton(hWnd, IDC_PRINTER_APPEND, g_bPrinterAppend ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hWnd, IDC_SPIN_PRINTER_IDLE, UDM_SETRANGE, 0, MAKELONG(999,0));
SendDlgItemMessage(hWnd, IDC_SPIN_PRINTER_IDLE, UDM_SETPOS, 0, MAKELONG(Printer_GetIdleLimit (),0));
SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)Printer_GetFilename());
SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)Printer_GetFilename().c_str());
InitOptions(hWnd);

View file

@ -121,7 +121,7 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
case IDC_CIDERPRESS_BROWSE:
{
std::string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") );
RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, CiderPressLoc.c_str());
RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, CiderPressLoc);
SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME, WM_SETTEXT, 0, (LPARAM) CiderPressLoc.c_str());
}
break;
@ -134,15 +134,15 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
if (strlen(sg_Disk2Card.GetFullName(DRIVE_1)) > 0)
if (!sg_Disk2Card.GetFullName(DRIVE_1).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_1));
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_1).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
}
if (strlen(sg_Disk2Card.GetFullName(DRIVE_2)) > 0)
if (!sg_Disk2Card.GetFullName(DRIVE_2).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_2));
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_2).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
}
@ -171,15 +171,15 @@ void CPageDisk::InitComboHDD(HWND hWnd)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD1, m_defaultHDDOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD2, m_defaultHDDOptions, -1);
if (strlen(HD_GetFullName(HARDDISK_1)) > 0)
if (!HD_GetFullName(HARDDISK_1).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_1).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_SETCURSEL, 0, 0);
}
if (strlen(HD_GetFullName(HARDDISK_2)) > 0)
if (!HD_GetFullName(HARDDISK_2).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_2).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_SETCURSEL, 0, 0);
}
}
@ -255,13 +255,13 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
}
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(driveSelected));
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(driveSelected).c_str());
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
// If the HD was in the other combo, remove now
DWORD comboOther = (comboSelected == IDC_COMBO_HDD1) ? IDC_COMBO_HDD2 : IDC_COMBO_HDD1;
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)HD_GetFullName(driveSelected));
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)HD_GetFullName(driveSelected).c_str());
if (duplicated != CB_ERR)
{
SendDlgItemMessage(hWnd, comboOther, CB_DELETESTRING, duplicated, 0);
@ -316,13 +316,13 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
}
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(driveSelected));
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(driveSelected).c_str());
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
// If the FD was in the other combo, remove now
DWORD comboOther = (comboSelected == IDC_COMBO_DISK1) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK1;
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)sg_Disk2Card.GetFullName(driveSelected));
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)sg_Disk2Card.GetFullName(driveSelected).c_str());
if (duplicated != CB_ERR)
{
SendDlgItemMessage(hWnd, comboOther, CB_DELETESTRING, duplicated, 0);

View file

@ -137,8 +137,8 @@ void CPropertySheetHelper::SetSlot5(SS_CARDTYPE NewCardType)
// . CPageAdvanced: IDC_PRINTER_DUMP_FILENAME_BROWSE
std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS)
{
static char PathToFile[MAX_PATH] = {0}; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
strcpy(PathToFile, Snapshot_GetFilename()); //RAPCS, line 2.
static std::string PathToFile; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
PathToFile = Snapshot_GetFilename(); //RAPCS, line 2.
TCHAR szDirectory[MAX_PATH] = TEXT("");
TCHAR szFilename[MAX_PATH];
RegLoadString(TEXT("Configuration"), REGVALUE, 1, szFilename, MAX_PATH, TEXT(""));
@ -163,11 +163,11 @@ std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TC
int nRes = GetOpenFileName(&ofn);
if(nRes) // Okay is pressed
{
strcpy(m_szNewFilename, &szFilename[ofn.nFileOffset]); // TODO:TC: m_szNewFilename not used! (Was g_szNewFilename)
m_szNewFilename = &szFilename[ofn.nFileOffset]; // TODO:TC: m_szNewFilename not used! (Was g_szNewFilename)
szFilename[ofn.nFileOffset] = 0;
if (_tcsicmp(szDirectory, szFilename))
strcpy(m_szSSNewDirectory, szFilename); // TODO:TC: m_szSSNewDirectory looks dodgy! (Was g_szSSNewDirectory)
m_szSSNewDirectory = szFilename; // TODO:TC: m_szSSNewDirectory looks dodgy! (Was g_szSSNewDirectory)
PathName = szFilename;
PathName.append (m_szNewFilename);
@ -178,7 +178,7 @@ std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TC
PathName = szFilename;
}
strcpy(m_szNewFilename, PathToFile); //RAPCS, line 3 (last).
m_szNewFilename = PathToFile; //RAPCS, line 3 (last).
return PathName;
}
@ -190,52 +190,56 @@ void CPropertySheetHelper::SaveStateUpdate()
RegSaveString(TEXT(REG_CONFIG), REGVALUE_SAVESTATE_FILENAME, 1, m_szSSNewPathname);
if(m_szSSNewDirectory[0])
if(!m_szSSNewDirectory.empty())
RegSaveString(TEXT(REG_PREFS), REGVALUE_PREF_START_DIR, 1, m_szSSNewDirectory);
}
}
void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
void CPropertySheetHelper::GetDiskBaseNameWithAWS(std::string & pszFilename)
{
LPCTSTR pDiskName = sg_Disk2Card.GetBaseName(DRIVE_1);
if (pDiskName && pDiskName[0])
const std::string & pDiskName = sg_Disk2Card.GetBaseName(DRIVE_1);
if (!pDiskName.empty())
{
strcpy(pszFilename, pDiskName);
strcpy(&pszFilename[strlen(pDiskName)], ".aws.yaml");
pszFilename = pDiskName + ".aws.yaml";
}
}
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
{
TCHAR szDirectory[MAX_PATH] = TEXT("");
TCHAR szFilename[MAX_PATH] = {0};
std::string szDirectory;
std::string tempFilename;
if (bSave)
{
// Attempt to use drive1's image name as the name for the .aws file
// Else Attempt to use the Prop Sheet's filename
GetDiskBaseNameWithAWS(szFilename);
if (szFilename[0] == 0)
GetDiskBaseNameWithAWS(tempFilename);
if (tempFilename.empty())
{
strcpy(szFilename, Snapshot_GetFilename());
tempFilename = Snapshot_GetFilename();
}
}
else // Load (or Browse)
{
// Attempt to use the Prop Sheet's filename first
// Else attempt to use drive1's image name as the name for the .aws file
strcpy(szFilename, Snapshot_GetFilename());
if (szFilename[0] == 0)
tempFilename = Snapshot_GetFilename();
if (tempFilename.empty())
{
GetDiskBaseNameWithAWS(szFilename);
GetDiskBaseNameWithAWS(tempFilename);
}
strcpy(szDirectory, Snapshot_GetPath());
szDirectory = Snapshot_GetPath();
}
if (szDirectory[0] == 0)
strcpy(szDirectory, g_sCurrentDir);
if (szDirectory.empty())
szDirectory = g_sCurrentDir;
// convert tempFilename to char * for the rest of the function
TCHAR szFilename[MAX_PATH] = {0};
strcpy(szFilename, tempFilename.c_str());
tempFilename.clear(); // do NOT use this any longer
//
@ -257,7 +261,7 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
}
ofn.lpstrFile = szFilename; // Dialog strips the last .EXT from this string (eg. file.aws.yaml is displayed as: file.aws
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = szDirectory;
ofn.lpstrInitialDir = szDirectory.c_str();
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrTitle = pszTitle;
@ -297,12 +301,12 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
}
}
strcpy(m_szSSNewFilename, &szFilename[ofn.nFileOffset]);
strcpy(m_szSSNewPathname, szFilename);
m_szSSNewFilename = &szFilename[ofn.nFileOffset];
m_szSSNewPathname = szFilename;
szFilename[ofn.nFileOffset] = 0;
if (_tcsicmp(szDirectory, szFilename))
strcpy(m_szSSNewDirectory, szFilename);
if (_tcsicmp(szDirectory.c_str(), szFilename))
m_szSSNewDirectory = szFilename;
}
m_bSSNewFilename = nRes ? true : false;
@ -336,7 +340,7 @@ void CPropertySheetHelper::PostMsgAfterClose(HWND hWnd, PAGETYPE page)
if (m_ConfigNew.m_Apple2Type == A2TYPE_CLONE)
{
MessageBox(hWnd, "Error - Unable to change configuration\n\nReason: A specific clone wasn't selected from the Advanced tab", g_pAppTitle, MB_ICONSTOP | MB_SETFOREGROUND);
MessageBox(hWnd, "Error - Unable to change configuration\n\nReason: A specific clone wasn't selected from the Advanced tab", g_pAppTitle.c_str(), MB_ICONSTOP | MB_SETFOREGROUND);
return;
}

View file

@ -30,8 +30,8 @@ public:
}
void SaveCurrentConfig(void);
char* GetSSNewFilename(void) { return &m_szSSNewFilename[0]; }
void ClearSSNewDirectory(void) { m_szSSNewDirectory[0] = 0; }
const std::string & GetSSNewFilename(void) { return m_szSSNewFilename; }
void ClearSSNewDirectory(void) { m_szSSNewDirectory.clear(); }
// const CConfigNeedingRestart& GetConfigOld(void) { return m_ConfigOld; }
CConfigNeedingRestart& GetConfigNew(void) { return m_ConfigNew; }
bool IsConfigChanged(void) { return m_ConfigNew != m_ConfigOld; }
@ -50,15 +50,15 @@ private:
void RestoreCurrentConfig(void);
std::string GetSlot(const UINT uSlot);
std::string GetCardName(const SS_CARDTYPE CardType);
void GetDiskBaseNameWithAWS(TCHAR* pszFilename);
void GetDiskBaseNameWithAWS(std::string & pszFilename);
PAGETYPE m_LastPage;
UINT32 m_bmPages;
char m_szNewFilename[MAX_PATH];
std::string m_szNewFilename;
bool m_bSSNewFilename;
char m_szSSNewDirectory[MAX_PATH];
char m_szSSNewFilename[MAX_PATH];
char m_szSSNewPathname[MAX_PATH];
std::string m_szSSNewDirectory;
std::string m_szSSNewFilename;
std::string m_szSSNewPathname;
CConfigNeedingRestart m_ConfigOld;
CConfigNeedingRestart m_ConfigNew;
bool m_bDoBenchmark;

View file

@ -225,7 +225,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ProfileOpmode_t g_aProfileOpmodes[ NUM_OPMODES ];
unsigned __int64 g_nProfileBeginCycles = 0; // g_nCumulativeCycles // PROFILE RESET
TCHAR g_FileNameProfile[] = TEXT("Profile.txt"); // changed from .csv to .txt since Excel doesn't give import options.
const std::string g_FileNameProfile = TEXT("Profile.txt"); // changed from .csv to .txt since Excel doesn't give import options.
int g_nProfileLine = 0;
char g_aProfileLine[ NUM_PROFILE_LINES ][ CONSOLE_WIDTH ];
@ -245,7 +245,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bool g_bSourceAddSymbols = false;
bool g_bSourceAddMemory = false;
char g_aSourceFileName[ MAX_PATH ] = "";
std::string g_aSourceFileName;
MemoryTextFile_t g_AssemblerSourceBuffer;
@ -285,7 +285,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Misc. __________________________________________________________________________________________
char g_sFileNameConfig [] =
std::string g_sFileNameConfig =
#ifdef MSDOS
"AWDEBUGR.CFG";
#else
@ -337,7 +337,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static void _ConfigColorsReset ( BYTE *pPalDst = 0 );
// Config - Save
bool ConfigSave_BufferToDisk ( char *pFileName, ConfigSave_t eConfigSave );
bool ConfigSave_BufferToDisk ( const char *pFileName, ConfigSave_t eConfigSave );
void ConfigSave_PrepareHeader ( const Parameters_e eCategory, const Commands_e eCommandClear );
// Drawing
@ -347,7 +347,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static void _UpdateWindowFontHeights (int nFontHeight);
// Source Level Debugging
static bool BufferAssemblyListing ( char * pFileName );
static bool BufferAssemblyListing ( const std::string & pFileName );
static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols );
@ -2024,31 +2024,29 @@ Update_t CmdTraceFile (int nArgs)
}
else
{
char sFileName[MAX_PATH];
std::string sFileName;
if (nArgs)
strcpy( sFileName, g_aArgs[1].sArg );
sFileName = g_aArgs[1].sArg;
else
strcpy( sFileName, g_sFileNameTrace );
sFileName = g_sFileNameTrace;
g_bTraceFileWithVideoScanner = (nArgs >= 2);
char sFilePath[ MAX_PATH ];
strcpy(sFilePath, g_sCurrentDir); // TODO: g_sDebugDir
strcat(sFilePath, sFileName );
const std::string sFilePath = g_sCurrentDir + sFileName;
g_hTraceFile = fopen( sFilePath, "wt" );
g_hTraceFile = fopen( sFilePath.c_str(), "wt" );
if (g_hTraceFile)
{
const char* pTextHdr = g_bTraceFileWithVideoScanner ? "Trace (with video info) started: %s"
: "Trace started: %s";
ConsoleBufferPushFormat( sText, pTextHdr, sFilePath );
ConsoleBufferPushFormat( sText, pTextHdr, sFilePath.c_str() );
g_bTraceHeader = true;
}
else
{
ConsoleBufferPushFormat( sText, "Trace ERROR: %s", sFilePath );
ConsoleBufferPushFormat( sText, "Trace ERROR: %s", sFilePath.c_str() );
}
}
@ -2324,7 +2322,7 @@ Update_t CmdConfigLoad (int nArgs)
//===========================================================================
bool ConfigSave_BufferToDisk ( char *pFileName, ConfigSave_t eConfigSave )
bool ConfigSave_BufferToDisk ( const char *pFileName, ConfigSave_t eConfigSave )
{
bool bStatus = false;
@ -2337,10 +2335,7 @@ bool ConfigSave_BufferToDisk ( char *pFileName, ConfigSave_t eConfigSave )
if (eConfigSave == CONFIG_SAVE_FILE_APPEND)
pMode = sModeAppend;
char sFileName[ MAX_PATH ];
_tcscpy(sFileName, g_sCurrentDir); // TODO: g_sDebugDir
_tcscat(sFileName, pFileName );
const std::string sFileName = g_sCurrentDir + pFileName; // TODO: g_sDebugDir
FILE *hFile = fopen( pFileName, pMode );
@ -2394,9 +2389,7 @@ void ConfigSave_PrepareHeader ( const Parameters_e eCategory, const Commands_e e
//===========================================================================
Update_t CmdConfigSave (int nArgs)
{
TCHAR sFilename[ MAX_PATH ];
_tcscpy( sFilename, g_sProgramDir ); // TODO: g_sDebugDir
_tcscat( sFilename, g_sFileNameConfig );
const std::string sFilename = g_sProgramDir + g_sFileNameConfig;
/*
HANDLE hFile = CreateFile( sfilename,
@ -4108,7 +4101,7 @@ Update_t CmdMemoryFill (int nArgs)
}
static TCHAR g_sMemoryLoadSaveFileName[ MAX_PATH ] = TEXT("");
static std::string g_sMemoryLoadSaveFileName;
// "PWD"
@ -4120,7 +4113,7 @@ Update_t CmdConfigGetDebugDir (int nArgs)
TCHAR sPath[ MAX_PATH + 8 ];
// TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?!
ConsoleBufferPushFormat( sPath, "Path: %s", g_sCurrentDir );
ConsoleBufferPushFormat( sPath, "Path: %s", g_sCurrentDir.c_str() );
return ConsoleUpdate();
}
@ -4142,30 +4135,27 @@ Update_t CmdConfigSetDebugDir (int nArgs)
if (strncmp("\\\\?\\", g_aArgs[1].sArg, 4) == 0)
return Help_Arg_1( CMD_CONFIG_SET_DEBUG_DIR );
TCHAR sPath[ MAX_PATH + 1 ];
std::string sPath;
if (g_aArgs[1].sArg[1] == ':') // Absolute
{
_tcscpy( sPath, g_aArgs[1].sArg );
sPath = g_aArgs[1].sArg;
}
else if (g_aArgs[1].sArg[0] == '\\') // Absolute
{
if (g_sCurrentDir[1] == ':')
{
_tcsncpy( sPath, g_sCurrentDir, 2 ); // Prefix with drive letter & colon
sPath[2] = 0;
_tcscat( sPath, g_aArgs[1].sArg );
sPath = g_sCurrentDir.substr(0, 2) + g_aArgs[1].sArg; // Prefix with drive letter & colon
}
else
{
_tcscpy( sPath, g_aArgs[1].sArg );
sPath = g_aArgs[1].sArg;
}
}
else // Relative
{
// TODO: Support ".." - currently just appends (which still works)
_tcscpy( sPath, g_sCurrentDir ); // TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?!
_tcscat( sPath, g_aArgs[1].sArg );
sPath = g_sCurrentDir + g_aArgs[1].sArg; // TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?!
}
if ( SetCurrentImageDir( sPath ) )
@ -4407,9 +4397,6 @@ Update_t CmdMemoryLoad (int nArgs)
if (g_aArgs[ iArgComma1 ].eToken != TOKEN_COMMA)
return Help_Arg_1( CMD_MEMORY_LOAD );
TCHAR sLoadSaveFilePath[ MAX_PATH ];
_tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // TODO: g_sDebugDir
WORD nAddressStart = 0;
WORD nAddress2 = 0;
WORD nAddressEnd = 0;
@ -4443,9 +4430,9 @@ Update_t CmdMemoryLoad (int nArgs)
if (bHaveFileName)
{
_tcscpy( g_sMemoryLoadSaveFileName, pFileName );
g_sMemoryLoadSaveFileName = pFileName;
}
_tcscat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
const std::string sLoadSaveFilePath = g_sCurrentDir + g_sMemoryLoadSaveFileName; // TODO: g_sDebugDir
BYTE * const pMemBankBase = bBankSpecified ? MemGetBankPtr(nBank) : mem;
if (!pMemBankBase)
@ -4454,7 +4441,7 @@ Update_t CmdMemoryLoad (int nArgs)
return ConsoleUpdate();
}
FILE *hFile = fopen( sLoadSaveFilePath, "rb" );
FILE *hFile = fopen( sLoadSaveFilePath.c_str(), "rb" );
if (hFile)
{
int nFileBytes = _GetFileSize( hFile );
@ -4499,7 +4486,7 @@ Update_t CmdMemoryLoad (int nArgs)
CmdConfigGetDebugDir( 0 );
TCHAR sFile[ MAX_PATH + 8 ];
ConsoleBufferPushFormat( sFile, "File: ", g_sMemoryLoadSaveFileName );
ConsoleBufferPushFormat( sFile, "File: ", g_sMemoryLoadSaveFileName.c_str() );
}
return ConsoleUpdate();
@ -4768,8 +4755,7 @@ Update_t CmdMemorySave (int nArgs)
// (g_aArgs[ iArgComma2 ].eToken != TOKEN_COLON))
// return Help_Arg_1( CMD_MEMORY_SAVE );
TCHAR sLoadSaveFilePath[ MAX_PATH ];
_tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // g_sProgramDir
std::string sLoadSaveFilePath = g_sCurrentDir; // g_sProgramDir
RangeType_t eRange;
eRange = Range_Get( nAddressStart, nAddress2, iArgAddress );
@ -4782,16 +4768,18 @@ Update_t CmdMemorySave (int nArgs)
{
if (! bHaveFileName)
{
TCHAR sMemoryLoadSaveFileName[MAX_PATH];
if (! bBankSpecified)
sprintf( g_sMemoryLoadSaveFileName, "%04X.%04X.bin", nAddressStart, nAddressLen );
sprintf( sMemoryLoadSaveFileName, "%04X.%04X.bin", nAddressStart, nAddressLen );
else
sprintf( g_sMemoryLoadSaveFileName, "%04X.%04X.bank%02X.bin", nAddressStart, nAddressLen, nBank );
sprintf( sMemoryLoadSaveFileName, "%04X.%04X.bank%02X.bin", nAddressStart, nAddressLen, nBank );
g_sMemoryLoadSaveFileName = sMemoryLoadSaveFileName;
}
else
{
_tcscpy( g_sMemoryLoadSaveFileName, g_aArgs[ 1 ].sArg );
g_sMemoryLoadSaveFileName = g_aArgs[ 1 ].sArg;
}
_tcscat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
sLoadSaveFilePath += g_sMemoryLoadSaveFileName;
const BYTE * const pMemBankBase = bBankSpecified ? MemGetBankPtr(nBank) : mem;
if (!pMemBankBase)
@ -4800,7 +4788,7 @@ Update_t CmdMemorySave (int nArgs)
return ConsoleUpdate();
}
FILE *hFile = fopen( sLoadSaveFilePath, "rb" );
FILE *hFile = fopen( sLoadSaveFilePath.c_str(), "rb" );
if (hFile)
{
ConsoleBufferPush( TEXT( "Warning: File already exists. Overwriting." ) );
@ -4808,7 +4796,7 @@ Update_t CmdMemorySave (int nArgs)
// TODO: BUG: Is this a bug/feature that we can over-write files and the user has no control over that?
}
hFile = fopen( sLoadSaveFilePath, "wb" );
hFile = fopen( sLoadSaveFilePath.c_str(), "wb" );
if (hFile)
{
size_t nWrote = fwrite( pMemBankBase+nAddressStart, nAddressLen, 1, hFile );
@ -5058,9 +5046,8 @@ Update_t CmdNTSC (int nArgs)
if( nLen == 0 )
pFileName = "AppleWinNTSC4096x4@32.data";
static TCHAR sPaletteFilePath[ MAX_PATH ];
_tcscpy( sPaletteFilePath, g_sCurrentDir );
_tcscat( sPaletteFilePath, pFileName );
static std::string sPaletteFilePath;
sPaletteFilePath = g_sCurrentDir + pFileName;
class ConsoleFilename
{
@ -5070,7 +5057,7 @@ Update_t CmdNTSC (int nArgs)
TCHAR text[ CONSOLE_WIDTH*2 ] = TEXT("");
size_t len1 = strlen( pPrefixText );
size_t len2 = strlen( sPaletteFilePath );
size_t len2 = sPaletteFilePath.size();
size_t len = len1 + len2;
if (len >= CONSOLE_WIDTH)
@ -5086,12 +5073,12 @@ Update_t CmdNTSC (int nArgs)
#endif
// File path is too long
// TODO: Need to split very long path names
strncpy( text, sPaletteFilePath, CONSOLE_WIDTH );
strncpy( text, sPaletteFilePath.c_str(), CONSOLE_WIDTH );
ConsoleBufferPush( text ); // TODO: Switch ConsoleBufferPush() to ConsoleBufferPushFormat()
}
else
{
ConsoleBufferPushFormat( text, "%s: %s", pPrefixText, sPaletteFilePath );
ConsoleBufferPushFormat( text, "%s: %s", pPrefixText, sPaletteFilePath.c_str() );
}
}
};
@ -5453,7 +5440,7 @@ Update_t CmdNTSC (int nArgs)
else
if (iParam == PARAM_SAVE)
{
FILE *pFile = fopen( sPaletteFilePath, "w+b" );
FILE *pFile = fopen( sPaletteFilePath.c_str(), "w+b" );
if( pFile )
{
size_t nWrote = 0;
@ -5496,7 +5483,7 @@ Update_t CmdNTSC (int nArgs)
else
if (iParam == PARAM_LOAD)
{
FILE *pFile = fopen( sPaletteFilePath, "rb" );
FILE *pFile = fopen( sPaletteFilePath.c_str(), "rb" );
if( pFile )
{
strcpy( aStatusText, "Loaded" );
@ -5631,36 +5618,35 @@ int CmdTextSave (int nArgs)
char *pText;
size_t nSize = Util_GetTextScreen( pText );
TCHAR sLoadSaveFilePath[ MAX_PATH ];
_tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // g_sProgramDir
std::string sLoadSaveFilePath = g_sCurrentDir; // g_sProgramDir
if( bHaveFileName )
_tcscpy( g_sMemoryLoadSaveFileName, g_aArgs[ 1 ].sArg );
g_sMemoryLoadSaveFileName = g_aArgs[ 1 ].sArg;
else
{
if( VideoGetSW80COL() )
sprintf( g_sMemoryLoadSaveFileName, "AppleWin_Text80.txt" );
g_sMemoryLoadSaveFileName = "AppleWin_Text80.txt";
else
sprintf( g_sMemoryLoadSaveFileName, "AppleWin_Text40.txt" );
g_sMemoryLoadSaveFileName = "AppleWin_Text40.txt";
}
_tcscat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
sLoadSaveFilePath += g_sMemoryLoadSaveFileName;
FILE *hFile = fopen( sLoadSaveFilePath, "rb" );
FILE *hFile = fopen( sLoadSaveFilePath.c_str(), "rb" );
if (hFile)
{
ConsoleBufferPush( TEXT( "Warning: File already exists. Overwriting." ) );
fclose( hFile );
}
hFile = fopen( sLoadSaveFilePath, "wb" );
hFile = fopen( sLoadSaveFilePath.c_str(), "wb" );
if (hFile)
{
size_t nWrote = fwrite( pText, nSize, 1, hFile );
if (nWrote == 1)
{
TCHAR text[ CONSOLE_WIDTH ] = TEXT("");
ConsoleBufferPushFormat( text, "Saved: %s", g_sMemoryLoadSaveFileName );
ConsoleBufferPushFormat( text, "Saved: %s", g_sMemoryLoadSaveFileName.c_str() );
}
else
{
@ -6464,27 +6450,25 @@ Update_t CmdOutputRun (int nArgs)
// IF @ON ....
MemoryTextFile_t script;
TCHAR * pFileName = g_aArgs[ 1 ].sArg;
const std::string pFileName = g_aArgs[ 1 ].sArg;
TCHAR sFileName[ MAX_PATH ];
TCHAR sMiniFileName[ CONSOLE_WIDTH ];
std::string sFileName;
std::string sMiniFileName; // [CONSOLE_WIDTH];
// if (g_aArgs[1].bType & TYPE_QUOTED_2)
_tcsncpy( sMiniFileName, pFileName, sizeof(sMiniFileName) );
sMiniFileName[sizeof(sMiniFileName)-1] = 0;
sMiniFileName = pFileName.substr(0, min(pFileName.size(), CONSOLE_WIDTH));
// _tcscat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
if (pFileName[0] == '\\' || pFileName[1] == ':') // NB. Any prefix quote has already been stripped
{
// Abs pathname
_tcscpy(sFileName, sMiniFileName);
sFileName = sMiniFileName;
}
else
{
// Rel pathname
_tcscpy(sFileName, g_sCurrentDir);
_tcscat(sFileName, sMiniFileName);
sFileName = g_sCurrentDir + sMiniFileName;
}
if (script.Read( sFileName ))
@ -6507,7 +6491,7 @@ Update_t CmdOutputRun (int nArgs)
ConsolePrintFormat( sText, "%sCouldn't load filename: %s%s"
, CHC_ERROR
, CHC_STRING
, sFileName
, sFileName.c_str()
);
}
@ -6518,11 +6502,11 @@ Update_t CmdOutputRun (int nArgs)
// Source Level Debugging _________________________________________________________________________
//===========================================================================
bool BufferAssemblyListing( char *pFileName )
bool BufferAssemblyListing( const std::string & pFileName )
{
bool bStatus = false; // true = loaded
if (! pFileName)
if (pFileName.empty())
return bStatus;
g_AssemblerSourceBuffer.Reset();
@ -6740,10 +6724,10 @@ Update_t CmdSource (int nArgs)
for( int iArg = 1; iArg <= nArgs; iArg++ )
{
TCHAR *pFileName = g_aArgs[ iArg ].sArg;
const std::string pFileName = g_aArgs[ iArg ].sArg;
int iParam;
bool bFound = FindParam( pFileName, MATCH_EXACT, iParam, _PARAM_SOURCE_BEGIN, _PARAM_SOURCE_END ) > 0 ? true : false;
bool bFound = FindParam( pFileName.c_str(), MATCH_EXACT, iParam, _PARAM_SOURCE_BEGIN, _PARAM_SOURCE_END ) > 0 ? true : false;
if (bFound && (iParam == PARAM_SRC_SYMBOLS))
{
g_bSourceAddSymbols = true;
@ -6755,35 +6739,32 @@ Update_t CmdSource (int nArgs)
}
else
{
TCHAR sFileName[MAX_PATH];
_tcscpy(sFileName,g_sProgramDir);
_tcscat(sFileName, pFileName);
const std::string sFileName = g_sProgramDir + pFileName;
const int MAX_MINI_FILENAME = 20;
TCHAR sMiniFileName[ MAX_MINI_FILENAME + 1 ];
_tcsncpy( sMiniFileName, pFileName, MAX_MINI_FILENAME - 1 );
sMiniFileName[ MAX_MINI_FILENAME ] = 0;
const std::string sMiniFileName = sFileName.substr(0, min(MAX_MINI_FILENAME, sFileName.size()));
TCHAR buffer[MAX_PATH] = { 0 };
if (BufferAssemblyListing( sFileName ))
{
_tcscpy( g_aSourceFileName, pFileName );
g_aSourceFileName = pFileName;
if (! ParseAssemblyListing( g_bSourceAddMemory, g_bSourceAddSymbols ))
{
ConsoleBufferPushFormat( sFileName, "Couldn't load filename: %s", sMiniFileName );
ConsoleBufferPushFormat( buffer, "Couldn't load filename: %s", sMiniFileName.c_str() );
}
else
{
if (g_nSourceAssembleBytes)
{
ConsoleBufferPushFormat( sFileName, " Read: %d lines, %d symbols, %d bytes"
ConsoleBufferPushFormat( buffer, " Read: %d lines, %d symbols, %d bytes"
, g_AssemblerSourceBuffer.GetNumLines() // g_nSourceAssemblyLines
, g_nSourceAssemblySymbols, g_nSourceAssembleBytes );
}
else
{
ConsoleBufferPushFormat( sFileName, " Read: %d lines, %d symbols"
ConsoleBufferPushFormat( buffer, " Read: %d lines, %d symbols"
, g_AssemblerSourceBuffer.GetNumLines() // g_nSourceAssemblyLines
, g_nSourceAssemblySymbols );
}
@ -6791,7 +6772,7 @@ Update_t CmdSource (int nArgs)
}
else
{
ConsoleBufferPushFormat( sFileName, "Error reading: %s", sMiniFileName );
ConsoleBufferPushFormat( buffer, "Error reading: %s", sMiniFileName.c_str() );
}
}
}
@ -7659,7 +7640,7 @@ Update_t CmdZeroPagePointer (int nArgs)
// Note: Range is [iParamBegin,iParamEnd], not the usually (STL) expected [iParamBegin,iParamEnd)
//===========================================================================
int FindParam( LPTSTR pLookupName, Match_e eMatch, int & iParam_, int iParamBegin, int iParamEnd )
int FindParam(LPCTSTR pLookupName, Match_e eMatch, int & iParam_, int iParamBegin, int iParamEnd )
{
int nFound = 0;
int nLen = _tcslen( pLookupName );
@ -7723,7 +7704,7 @@ int FindParam( LPTSTR pLookupName, Match_e eMatch, int & iParam_, int iParamBegi
}
//===========================================================================
int FindCommand( LPTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
int FindCommand( LPCTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
{
g_vPotentialCommands.erase( g_vPotentialCommands.begin(), g_vPotentialCommands.end() );
@ -8446,11 +8427,9 @@ bool ProfileSave()
{
bool bStatus = false;
char sFilename[MAX_PATH];
strcpy( sFilename, g_sProgramDir ); // TODO: Allow user to decide?
strcat( sFilename, g_FileNameProfile );
const std::string sFilename = g_sProgramDir + g_FileNameProfile; // TODO: Allow user to decide?
FILE *hFile = fopen( sFilename, "wt" );
FILE *hFile = fopen( sFilename.c_str(), "wt" );
if (hFile)
{

View file

@ -66,7 +66,7 @@
};
// Config - FileName
extern char g_sFileNameConfig[];
extern std::string g_sFileNameConfig;
// Cursor
extern WORD g_nDisasmTopAddress ;
@ -107,7 +107,7 @@
extern std::vector<int> g_vMemorySearchResults;
// Source Level Debugging
extern TCHAR g_aSourceFileName[ MAX_PATH ];
extern std::string g_aSourceFileName;
extern MemoryTextFile_t g_AssemblerSourceBuffer;
extern int g_iSourceDisplayStart ;

View file

@ -3767,17 +3767,12 @@ void DrawSubWindow_Source2 (Update_t bUpdate)
rect.right = DISPLAY_DISASM_RIGHT; // HACK: MAGIC #: 7
// Draw Title
char sTitle[ CONSOLE_WIDTH ];
char sText [ CONSOLE_WIDTH ];
strcpy ( sTitle, " Source: " );
int maxSizeToCopy = g_nConsoleDisplayWidth - strlen(sTitle) - 1;
strncpy( sText , g_aSourceFileName, maxSizeToCopy );
sText[ maxSizeToCopy - 1 ] = 0;
strcat ( sTitle, sText );
std::string sTitle = " Source: " + g_aSourceFileName;
sTitle.resize(min(sTitle.size(), size_t(g_nConsoleDisplayWidth)));
DebuggerSetColorBG( DebuggerGetColor( BG_SOURCE_TITLE ));
DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE_TITLE ));
PrintText( sTitle, rect );
PrintText( sTitle.c_str(), rect );
rect.top += g_nFontHeight;
// Draw Source Lines

View file

@ -14,8 +14,8 @@
void DisplayAmbigiousCommands ( int nFound );
int FindParam( LPTSTR pLookupName, Match_e eMatch, int & iParam_, const int iParamBegin = 0, const int iParamEnd = NUM_PARAMS - 1 );
int FindCommand( LPTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ = NULL );
int FindParam( LPCTSTR pLookupName, Match_e eMatch, int & iParam_, const int iParamBegin = 0, const int iParamEnd = NUM_PARAMS - 1 );
int FindCommand( LPCTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ = NULL );
inline void UnpackVersion( const unsigned int nVersion,
int & nMajor_, int & nMinor_, int & nFixMajor_ , int & nFixMinor_ )

View file

@ -52,7 +52,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
,"A2_DOS33.SYM"
,"A2_PRODOS.SYM"
};
char g_sFileNameSymbolsUser [ MAX_PATH ] = "";
std::string g_sFileNameSymbolsUser;
char * g_aSymbolTableNames[ NUM_SYMBOL_TABLES ] =
{
@ -84,7 +84,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//===========================================================================
void _PrintCurrentPath()
{
ConsoleDisplayError( g_sProgramDir );
ConsoleDisplayError( g_sProgramDir.c_str() );
}
Update_t _PrintSymbolInvalidTable()
@ -551,7 +551,7 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables )
//===========================================================================
int ParseSymbolTable( TCHAR *pPathFileName, SymbolTable_Index_e eSymbolTableWrite, int nSymbolOffset )
int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSymbolTableWrite, int nSymbolOffset )
{
char sText[ CONSOLE_WIDTH * 3 ];
bool bFileDisplayed = false;
@ -560,7 +560,7 @@ int ParseSymbolTable( TCHAR *pPathFileName, SymbolTable_Index_e eSymbolTableWrit
int nSymbolsLoaded = 0;
if (! pPathFileName)
if (pPathFileName.empty())
return nSymbolsLoaded;
//#if _UNICODE
@ -574,7 +574,7 @@ int ParseSymbolTable( TCHAR *pPathFileName, SymbolTable_Index_e eSymbolTableWrit
sprintf( sFormat1, "%%x %%%ds", MAX_SYMBOLS_LEN ); // i.e. "%x %13s"
sprintf( sFormat2, "%%%ds %%x", MAX_SYMBOLS_LEN ); // i.e. "%13s %x"
FILE *hFile = fopen( pPathFileName, "rt" );
FILE *hFile = fopen( pPathFileName.c_str(), "rt" );
if( !hFile && g_bSymbolsDisplayMissingFile )
{
@ -749,8 +749,7 @@ int ParseSymbolTable( TCHAR *pPathFileName, SymbolTable_Index_e eSymbolTableWrit
//===========================================================================
Update_t CmdSymbolsLoad (int nArgs)
{
TCHAR sFileName[MAX_PATH];
_tcscpy(sFileName,g_sProgramDir);
std::string sFileName = g_sProgramDir;
int iSymbolTable = GetSymbolTableFromCommand();
if ((iSymbolTable < 0) || (iSymbolTable >= NUM_SYMBOL_TABLES))
@ -763,24 +762,23 @@ Update_t CmdSymbolsLoad (int nArgs)
// Debugger will call us with 0 args on startup as a way to pre-load symbol tables
if (! nArgs)
{
_tcscat(sFileName, g_sFileNameSymbols[ iSymbolTable ]);
sFileName += g_sFileNameSymbols[ iSymbolTable ];
nSymbols = ParseSymbolTable( sFileName, (SymbolTable_Index_e) iSymbolTable );
}
int iArg = 1;
if (iArg <= nArgs)
{
TCHAR *pFileName = NULL;
std::string pFileName;
if( g_aArgs[ iArg ].bType & TYPE_QUOTED_2 )
{
pFileName = g_aArgs[ iArg ].sArg;
_tcscpy(sFileName,g_sProgramDir);
_tcscat(sFileName, pFileName);
sFileName = g_sProgramDir + pFileName;
// Remember File Name of last symbols loaded
_tcscpy( g_sFileNameSymbolsUser, pFileName );
g_sFileNameSymbolsUser = pFileName;
}
// SymbolOffset
@ -804,7 +802,7 @@ Update_t CmdSymbolsLoad (int nArgs)
}
}
if( pFileName )
if( !pFileName.empty() )
{
nSymbols = ParseSymbolTable( sFileName, (SymbolTable_Index_e) iSymbolTable, nOffsetAddr );
}

View file

@ -13,5 +13,5 @@
bool _CmdSymbolList_Symbol2Address ( LPCTSTR pSymbol, int bSymbolTables );
// SymbolOffset
int ParseSymbolTable ( TCHAR *pFileName, SymbolTable_Index_e eWhichTableToLoad, int nSymbolOffset = 0 );
int ParseSymbolTable ( const std::string & pFileName, SymbolTable_Index_e eWhichTableToLoad, int nSymbolOffset = 0 );

View file

@ -31,10 +31,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const int EOL_NULL = 0;
//===========================================================================
bool MemoryTextFile_t::Read( char *pFileName )
bool MemoryTextFile_t::Read( const std::string & pFileName )
{
bool bStatus = false;
FILE *hFile = fopen( pFileName, "rb" );
FILE *hFile = fopen( pFileName.c_str(), "rb" );
if (hFile)
{

View file

@ -21,7 +21,7 @@
m_vLines.reserve( 128 );
}
bool Read( TCHAR *pFileName );
bool Read( const std::string & pFileName );
void Reset()
{
m_vBuffer.erase( m_vBuffer.begin(), m_vBuffer.end() );

View file

@ -177,7 +177,7 @@ void Disk2InterfaceCard::SaveLastDiskImage(const int drive)
if (!m_saveDiskImage)
return;
const TCHAR *pFileName = m_floppyDrive[drive].m_disk.m_fullname;
const std::string & pFileName = m_floppyDrive[drive].m_disk.m_fullname;
if (drive == DRIVE_1)
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_DISK_1), TRUE, pFileName);
@ -187,7 +187,7 @@ void Disk2InterfaceCard::SaveLastDiskImage(const int drive)
//
TCHAR szPathName[MAX_PATH];
StringCbCopy(szPathName, MAX_PATH, DiskGetFullPathName(drive));
StringCbCopy(szPathName, MAX_PATH, DiskGetFullPathName(drive).c_str());
TCHAR* slash = _tcsrchr(szPathName, TEXT('\\'));
if (slash != NULL)
{
@ -346,12 +346,12 @@ void Disk2InterfaceCard::RemoveDisk(const int drive)
pFloppy->m_trackimagedata = false;
}
memset( pFloppy->m_imagename, 0, MAX_DISK_IMAGE_NAME+1 );
memset( pFloppy->m_fullname , 0, MAX_DISK_FULL_NAME +1 );
pFloppy->m_imagename.clear();
pFloppy->m_fullname.clear();
pFloppy->m_strFilenameInZip = "";
SaveLastDiskImage( drive );
Video_ResetScreenshotCounter( NULL );
Video_ResetScreenshotCounter( "" );
}
//===========================================================================
@ -555,29 +555,29 @@ void Disk2InterfaceCard::EjectDisk(const int drive)
// Return the filename
// . Used by Drive Buttons' tooltips
LPCTSTR Disk2InterfaceCard::GetFullDiskFilename(const int drive)
const std::string & Disk2InterfaceCard::GetFullDiskFilename(const int drive)
{
if (!m_floppyDrive[drive].m_disk.m_strFilenameInZip.empty())
return m_floppyDrive[drive].m_disk.m_strFilenameInZip.c_str();
return m_floppyDrive[drive].m_disk.m_strFilenameInZip;
return GetFullName(drive);
}
// Return the file or zip name
// . Used by Property Sheet Page (Disk)
LPCTSTR Disk2InterfaceCard::GetFullName(const int drive)
const std::string & Disk2InterfaceCard::GetFullName(const int drive)
{
return m_floppyDrive[drive].m_disk.m_fullname;
}
// Return the imagename
// . Used by Drive Button's icons & Property Sheet Page (Save snapshot)
LPCTSTR Disk2InterfaceCard::GetBaseName(const int drive)
const std::string & Disk2InterfaceCard::GetBaseName(const int drive)
{
return m_floppyDrive[drive].m_disk.m_imagename;
}
LPCTSTR Disk2InterfaceCard::DiskGetFullPathName(const int drive)
const std::string & Disk2InterfaceCard::DiskGetFullPathName(const int drive)
{
return ImageGetPathname(m_floppyDrive[drive].m_disk.m_imagehandle);
}
@ -615,14 +615,14 @@ ImageError_e Disk2InterfaceCard::InsertDisk(const int drive, LPCTSTR pszImageFil
// Check if image is being used by the other drive, and if so remove it in order so it can be swapped
{
const char* pszOtherPathname = DiskGetFullPathName(!drive);
const std::string & pszOtherPathname = DiskGetFullPathName(!drive);
char szCurrentPathname[MAX_PATH];
DWORD uNameLen = GetFullPathName(pszImageFilename, MAX_PATH, szCurrentPathname, NULL);
if (uNameLen == 0 || uNameLen >= MAX_PATH)
strcpy_s(szCurrentPathname, MAX_PATH, pszImageFilename);
if (!strcmp(pszOtherPathname, szCurrentPathname))
if (!strcmp(pszOtherPathname.c_str(), szCurrentPathname))
{
EjectDisk(!drive);
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
@ -654,7 +654,7 @@ ImageError_e Disk2InterfaceCard::InsertDisk(const int drive, LPCTSTR pszImageFil
}
else
{
Video_ResetScreenshotCounter(NULL);
Video_ResetScreenshotCounter("");
}
SaveLastDiskImage(drive);
@ -777,7 +777,7 @@ void Disk2InterfaceCard::NotifyInvalidImage(const int drive, LPCTSTR pszImageFil
MessageBox(
g_hFrameWindow,
szBuffer,
g_pAppTitle,
g_pAppTitle.c_str(),
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
}

View file

@ -53,8 +53,8 @@ public:
void clear()
{
ZeroMemory(m_imagename, sizeof(m_imagename));
ZeroMemory(m_fullname, sizeof(m_fullname));
m_imagename.clear();
m_fullname.clear();
m_strFilenameInZip.clear();
m_imagehandle = NULL;
m_bWriteProtected = false;
@ -71,8 +71,8 @@ public:
}
public:
TCHAR m_imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension)
TCHAR m_fullname [ MAX_DISK_FULL_NAME + 1 ]; // <FILENAME.EXT> or <FILENAME.zip> : This is persisted to the snapshot file
std::string m_imagename; // <FILENAME> (ie. no extension)
std::string m_fullname; // <FILENAME.EXT> or <FILENAME.zip> : This is persisted to the snapshot file
std::string m_strFilenameInZip; // "" or <FILENAME.EXT>
ImageInfo* m_imagehandle; // Init'd by InsertDisk() -> ImageOpen()
bool m_bWriteProtected;
@ -130,9 +130,9 @@ public:
void Boot(void);
void FlushCurrentTrack(const int drive);
LPCTSTR GetFullDiskFilename(const int drive);
LPCTSTR GetFullName(const int drive);
LPCTSTR GetBaseName(const int drive);
const std::string & GetFullDiskFilename(const int drive);
const std::string & GetFullName(const int drive);
const std::string & GetBaseName(const int drive);
void GetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status);
ImageError_e InsertDisk(const int drive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
@ -182,7 +182,7 @@ private:
void ReadTrack(const int drive, ULONG uExecutedCycles);
void RemoveDisk(const int drive);
void WriteTrack(const int drive);
LPCTSTR DiskGetFullPathName(const int drive);
const std::string & DiskGetFullPathName(const int drive);
void ResetLogicStateSequencer(void);
void UpdateBitStreamPositionAndDiskCycle(const ULONG uExecutedCycles);
UINT GetBitCellDelta(const BYTE optimalBitTiming);

View file

@ -39,7 +39,7 @@ static CHardDiskImageHelper sg_HardDiskImageHelper;
//===========================================================================
// Pre: *pWriteProtected_ already set to file's r/w status - see DiskInsert()
ImageError_e ImageOpen( LPCTSTR pszImageFilename,
ImageError_e ImageOpen( const std::string & pszImageFilename,
ImageInfo** ppImageInfo,
bool* pWriteProtected,
const bool bCreateIfNecessary,
@ -49,7 +49,7 @@ ImageError_e ImageOpen( LPCTSTR pszImageFilename,
if (bExpectFloppy && sg_DiskImageHelper.GetWorkBuffer() == NULL)
return eIMAGE_ERROR_BAD_POINTER;
if (! (pszImageFilename && ppImageInfo && pWriteProtected))
if (!(!pszImageFilename.empty() && ppImageInfo && pWriteProtected))
return eIMAGE_ERROR_BAD_POINTER;
// CREATE A RECORD FOR THE FILE
@ -63,7 +63,7 @@ ImageError_e ImageOpen( LPCTSTR pszImageFilename,
if (bExpectFloppy) pImageInfo->pImageHelper = &sg_DiskImageHelper;
else pImageInfo->pImageHelper = &sg_HardDiskImageHelper;
ImageError_e Err = pImageInfo->pImageHelper->Open(pszImageFilename, pImageInfo, bCreateIfNecessary, strFilenameInZip);
ImageError_e Err = pImageInfo->pImageHelper->Open(pszImageFilename.c_str(), pImageInfo, bCreateIfNecessary, strFilenameInZip);
if (Err != eIMAGE_ERROR_NONE)
{
ImageClose(*ppImageInfo, true);
@ -239,9 +239,9 @@ bool ImageIsMultiFileZip(ImageInfo* const pImageInfo)
return pImageInfo ? (pImageInfo->uNumEntriesInZip > 1) : false;
}
const char* ImageGetPathname(ImageInfo* const pImageInfo)
const std::string & ImageGetPathname(ImageInfo* const pImageInfo)
{
static const char* szEmpty = "";
static const std::string szEmpty;
return pImageInfo ? pImageInfo->szFilename : szEmpty;
}
@ -277,7 +277,7 @@ UINT ImagePhaseToTrack(ImageInfo* const pImageInfo, const float phase, const boo
return track;
}
void GetImageTitle(LPCTSTR pPathname, TCHAR* pImageName, TCHAR* pFullName)
void GetImageTitle(LPCTSTR pPathname, std::string & pImageName, std::string & pFullName)
{
TCHAR imagetitle[ MAX_DISK_FULL_NAME+1 ];
LPCTSTR startpos = pPathname;
@ -304,8 +304,7 @@ void GetImageTitle(LPCTSTR pPathname, TCHAR* pImageName, TCHAR* pFullName)
CharLowerBuff(imagetitle+1, _tcslen(imagetitle+1));
// pFullName = <FILENAME.EXT>
_tcsncpy( pFullName, imagetitle, MAX_DISK_FULL_NAME );
pFullName[ MAX_DISK_FULL_NAME ] = 0;
pFullName = imagetitle;
if (imagetitle[0])
{
@ -317,6 +316,5 @@ void GetImageTitle(LPCTSTR pPathname, TCHAR* pImageName, TCHAR* pFullName)
}
// pImageName = <FILENAME> (ie. no extension)
_tcsncpy( pImageName, imagetitle, MAX_DISK_IMAGE_NAME );
pImageName[ MAX_DISK_IMAGE_NAME ] = 0;
pImageName = imagetitle;
}

View file

@ -65,7 +65,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
struct ImageInfo;
ImageError_e ImageOpen(LPCTSTR pszImageFilename, ImageInfo** ppImageInfo, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true);
ImageError_e ImageOpen(const std::string & pszImageFilename, ImageInfo** ppImageInfo, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true);
void ImageClose(ImageInfo* const pImageInfo, const bool bOpenError=false);
BOOL ImageBoot(ImageInfo* const pImageInfo);
void ImageDestroy(void);
@ -79,10 +79,10 @@ bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuff
UINT ImageGetNumTracks(ImageInfo* const pImageInfo);
bool ImageIsWriteProtected(ImageInfo* const pImageInfo);
bool ImageIsMultiFileZip(ImageInfo* const pImageInfo);
const char* ImageGetPathname(ImageInfo* const pImageInfo);
const std::string & ImageGetPathname(ImageInfo* const pImageInfo);
UINT ImageGetImageSize(ImageInfo* const pImageInfo);
bool ImageIsWOZ(ImageInfo* const pImageInfo);
BYTE ImageGetOptimalBitTiming(ImageInfo* const pImageInfo);
UINT ImagePhaseToTrack(ImageInfo* const pImageInfo, const float phase, const bool limit=true);
void GetImageTitle(LPCTSTR pPathname, TCHAR* pImageName, TCHAR* pFullName);
void GetImageTitle(LPCTSTR pPathname, std::string & pImageName, std::string & pFullName);

View file

@ -99,7 +99,7 @@ bool CImageBase::WriteTrack(ImageInfo* pImageInfo, const int nTrack, LPBYTE pTra
else if (pImageInfo->FileType == eFileGZip)
{
// Write entire compressed image each time (dirty track change or dirty disk removal)
gzFile hGZFile = gzopen(pImageInfo->szFilename, "wb");
gzFile hGZFile = gzopen(pImageInfo->szFilename.c_str(), "wb");
if (hGZFile == NULL)
return false;
@ -116,11 +116,11 @@ bool CImageBase::WriteTrack(ImageInfo* pImageInfo, const int nTrack, LPBYTE pTra
{
// Write entire compressed image each time (dirty track change or dirty disk removal)
// NB. Only support Zip archives with a single file
zipFile hZipFile = zipOpen(pImageInfo->szFilename, APPEND_STATUS_CREATE);
zipFile hZipFile = zipOpen(pImageInfo->szFilename.c_str(), APPEND_STATUS_CREATE);
if (hZipFile == NULL)
return false;
int nRes = zipOpenNewFileInZip(hZipFile, pImageInfo->szFilenameInZip, &pImageInfo->zipFileInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_SPEED);
int nRes = zipOpenNewFileInZip(hZipFile, pImageInfo->szFilenameInZip.c_str(), &pImageInfo->zipFileInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_SPEED);
if (nRes != ZIP_OK)
return false;
@ -220,7 +220,7 @@ bool CImageBase::WriteBlock(ImageInfo* pImageInfo, const int nBlock, LPBYTE pBlo
else if (pImageInfo->FileType == eFileGZip)
{
// Write entire compressed image each time a block is written
gzFile hGZFile = gzopen(pImageInfo->szFilename, "wb");
gzFile hGZFile = gzopen(pImageInfo->szFilename.c_str(), "wb");
if (hGZFile == NULL)
return false;
@ -237,11 +237,11 @@ bool CImageBase::WriteBlock(ImageInfo* pImageInfo, const int nBlock, LPBYTE pBlo
{
// Write entire compressed image each time a block is written
// NB. Only support Zip archives with a single file
zipFile hZipFile = zipOpen(pImageInfo->szFilename, APPEND_STATUS_CREATE);
zipFile hZipFile = zipOpen(pImageInfo->szFilename.c_str(), APPEND_STATUS_CREATE);
if (hZipFile == NULL)
return false;
int nRes = zipOpenNewFileInZip(hZipFile, pImageInfo->szFilenameInZip, &pImageInfo->zipFileInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_SPEED);
int nRes = zipOpenNewFileInZip(hZipFile, pImageInfo->szFilenameInZip.c_str(), &pImageInfo->zipFileInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_SPEED);
if (nRes != ZIP_OK)
return false;
@ -1469,8 +1469,7 @@ ImageError_e CImageHelperBase::CheckZipFile(LPCTSTR pszImageFilename, ImageInfo*
if (nRes != UNZ_OK)
return eIMAGE_ERROR_ZIP;
strncpy(pImageInfo->szFilenameInZip, szFilename, MAX_PATH);
pImageInfo->szFilenameInZip[MAX_PATH-1] = 0;
pImageInfo->szFilenameInZip = szFilename;
memcpy(&pImageInfo->zipFileInfo.tmz_date, &file_info.tmu_date, sizeof(file_info.tmu_date));
pImageInfo->zipFileInfo.dosDate = file_info.dosDate;
pImageInfo->zipFileInfo.internal_fa = file_info.internal_fa;
@ -1681,7 +1680,9 @@ ImageError_e CImageHelperBase::Open( LPCTSTR pszImageFilename,
if (Err != eIMAGE_ERROR_NONE)
return Err;
DWORD uNameLen = GetFullPathName(pszImageFilename, MAX_PATH, pImageInfo->szFilename, NULL);
TCHAR szFilename[MAX_PATH] = { 0 };
DWORD uNameLen = GetFullPathName(pszImageFilename, MAX_PATH, szFilename, NULL);
pImageInfo->szFilename = szFilename;
if (uNameLen == 0 || uNameLen >= MAX_PATH)
Err = eIMAGE_ERROR_FAILED_TO_GET_PATHNAME;
@ -1700,7 +1701,7 @@ void CImageHelperBase::Close(ImageInfo* pImageInfo, const bool bDeleteFile)
if (bDeleteFile)
{
DeleteFile(pImageInfo->szFilename);
DeleteFile(pImageInfo->szFilename.c_str());
}
pImageInfo->szFilename[0] = 0;

View file

@ -20,7 +20,7 @@ enum FileType_e {eFileNormal, eFileGZip, eFileZip};
struct ImageInfo
{
TCHAR szFilename[MAX_PATH];
std::string szFilename;
CImageBase* pImageType;
CImageHelperBase* pImageHelper;
FileType_e FileType;
@ -28,7 +28,7 @@ struct ImageInfo
DWORD uOffset;
bool bWriteProtected;
UINT uImageSize;
char szFilenameInZip[MAX_PATH];
std::string szFilenameInZip;
zip_fileinfo zipFileInfo;
UINT uNumEntriesInZip;
// Floppy only

View file

@ -249,48 +249,48 @@ UINT Get3DBorderHeight(void)
static void GetAppleWindowTitle()
{
static TCHAR g_pAppleWindowTitle[ 128 ] = "";
static std::string g_pAppleWindowTitle;
g_pAppTitle = g_pAppleWindowTitle;
switch (g_Apple2Type)
{
default:
case A2TYPE_APPLE2: _tcscpy(g_pAppleWindowTitle, TITLE_APPLE_2 ); break;
case A2TYPE_APPLE2PLUS: _tcscpy(g_pAppleWindowTitle, TITLE_APPLE_2_PLUS ); break;
case A2TYPE_APPLE2E: _tcscpy(g_pAppleWindowTitle, TITLE_APPLE_2E ); break;
case A2TYPE_APPLE2EENHANCED:_tcscpy(g_pAppleWindowTitle, TITLE_APPLE_2E_ENHANCED); break;
case A2TYPE_PRAVETS82: _tcscpy(g_pAppleWindowTitle, TITLE_PRAVETS_82 ); break;
case A2TYPE_PRAVETS8M: _tcscpy(g_pAppleWindowTitle, TITLE_PRAVETS_8M ); break;
case A2TYPE_PRAVETS8A: _tcscpy(g_pAppleWindowTitle, TITLE_PRAVETS_8A ); break;
case A2TYPE_TK30002E: _tcscpy(g_pAppleWindowTitle, TITLE_TK3000_2E ); break;
case A2TYPE_APPLE2: g_pAppleWindowTitle = TITLE_APPLE_2 ; break;
case A2TYPE_APPLE2PLUS: g_pAppleWindowTitle = TITLE_APPLE_2_PLUS ; break;
case A2TYPE_APPLE2E: g_pAppleWindowTitle = TITLE_APPLE_2E ; break;
case A2TYPE_APPLE2EENHANCED: g_pAppleWindowTitle = TITLE_APPLE_2E_ENHANCED; break;
case A2TYPE_PRAVETS82: g_pAppleWindowTitle = TITLE_PRAVETS_82 ; break;
case A2TYPE_PRAVETS8M: g_pAppleWindowTitle = TITLE_PRAVETS_8M ; break;
case A2TYPE_PRAVETS8A: g_pAppleWindowTitle = TITLE_PRAVETS_8A ; break;
case A2TYPE_TK30002E: g_pAppleWindowTitle = TITLE_TK3000_2E ; break;
}
#if _DEBUG
_tcscat( g_pAppleWindowTitle, " *DEBUG* " );
g_pAppleWindowTitle += " *DEBUG* ";
#endif
if (g_nAppMode == MODE_LOGO)
return;
// TODO: g_bDisplayVideoModeInTitle
_tcscat( g_pAppleWindowTitle, " - " );
g_pAppleWindowTitle += " - ";
if( IsVideoStyle(VS_HALF_SCANLINES) )
{
_tcscat( g_pAppleWindowTitle," 50% " );
g_pAppleWindowTitle += " 50% ";
}
_tcscat( g_pAppleWindowTitle, g_apVideoModeDesc[ g_eVideoType ] );
g_pAppleWindowTitle += g_apVideoModeDesc[ g_eVideoType ];
if (g_hCustomRomF8 != INVALID_HANDLE_VALUE)
_tcscat(g_pAppleWindowTitle,TEXT(" (custom rom)"));
g_pAppleWindowTitle += TEXT(" (custom rom)");
else if (sg_PropertySheet.GetTheFreezesF8Rom() && IS_APPLE2)
_tcscat(g_pAppleWindowTitle,TEXT(" (The Freeze's non-autostart F8 rom)"));
g_pAppleWindowTitle += TEXT(" (The Freeze's non-autostart F8 rom)");
switch (g_nAppMode)
{
case MODE_PAUSED : _tcscat(g_pAppleWindowTitle,TEXT(" [")); _tcscat(g_pAppleWindowTitle,TITLE_PAUSED ); _tcscat(g_pAppleWindowTitle,TEXT("]")); break;
case MODE_STEPPING: _tcscat(g_pAppleWindowTitle,TEXT(" [")); _tcscat(g_pAppleWindowTitle,TITLE_STEPPING); _tcscat(g_pAppleWindowTitle,TEXT("]")); break;
case MODE_PAUSED : g_pAppleWindowTitle += std::string(TEXT(" [")) + TITLE_PAUSED + TEXT("]"); break;
case MODE_STEPPING: g_pAppleWindowTitle += std::string(TEXT(" [")) + TITLE_STEPPING + TEXT("]"); break;
}
}
@ -513,7 +513,7 @@ static void DrawButton (HDC passdc, int number) {
SetTextColor(dc,RGB(0,0,0));
SetTextAlign(dc,TA_CENTER | TA_TOP);
SetBkMode(dc,TRANSPARENT);
LPCTSTR pszBaseName = sg_Disk2Card.GetBaseName(number-BTN_DRIVE1);
LPCTSTR pszBaseName = sg_Disk2Card.GetBaseName(number-BTN_DRIVE1).c_str();
ExtTextOut(dc,x+offset+22,rect.top,ETO_CLIPPED,&rect,
pszBaseName,
MIN(8,_tcslen(pszBaseName)),
@ -1022,7 +1022,7 @@ static void DrawStatusArea (HDC passdc, int drawflags)
if (drawflags & DRAW_TITLE)
{
GetAppleWindowTitle(); // SetWindowText() // WindowTitle
SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)g_pAppTitle);
SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)g_pAppTitle.c_str());
}
if (drawflags & DRAW_BUTTON_DRIVES)
@ -1685,7 +1685,7 @@ LRESULT CALLBACK FrameWndProc (
if(((LPNMTTDISPINFO)lparam)->hdr.hwndFrom == tooltipwindow &&
((LPNMTTDISPINFO)lparam)->hdr.code == TTN_GETDISPINFO)
((LPNMTTDISPINFO)lparam)->lpszText =
(LPTSTR)sg_Disk2Card.GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom);
(LPTSTR)sg_Disk2Card.GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom).c_str();
break;
case WM_PAINT:
@ -1969,20 +1969,16 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
case BTN_HELP:
{
TCHAR filename[MAX_PATH];
_tcscpy(filename,g_sProgramDir);
_tcscat(filename,TEXT("APPLEWIN.CHM"));
const std::string filename = g_sProgramDir + TEXT("APPLEWIN.CHM");
// (GH#437) For any internet downloaded AppleWin.chm files (stored on an NTFS drive) there may be an Alt Data Stream containing a Zone Identifier
// - try to delete it, otherwise the content won't be displayed unless it's unblock (via File Properties)
{
TCHAR filename_with_zone_identifier[MAX_PATH];
_tcscpy(filename_with_zone_identifier,filename);
_tcscat(filename_with_zone_identifier,TEXT(":Zone.Identifier"));
DeleteFile(filename_with_zone_identifier);
const std::string filename_with_zone_identifier = filename + TEXT(":Zone.Identifier");
DeleteFile(filename_with_zone_identifier.c_str());
}
HtmlHelp(g_hFrameWindow,filename,HH_DISPLAY_TOC,0);
HtmlHelp(g_hFrameWindow,filename.c_str(),HH_DISPLAY_TOC,0);
helpquit = 1;
}
break;
@ -2592,7 +2588,7 @@ void FrameCreateWindow(void)
// NB. g_hFrameWindow also set by WM_CREATE - NB. CreateWindow() must synchronously send WM_CREATE
g_hFrameWindow = CreateWindow(
TEXT("APPLE2FRAME"),
g_pAppTitle,
g_pAppTitle.c_str(),
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX | WS_VISIBLE,
nXPos, nYPos, nWidth, nHeight,

View file

@ -123,8 +123,8 @@ struct HDD
{
// This is not a POD (there is a std::string)
// ZeroMemory does not work
ZeroMemory(imagename, sizeof(imagename));
ZeroMemory(fullname, sizeof(fullname));
imagename.clear();
fullname.clear();
strFilenameInZip.clear();
imagehandle = NULL;
bWriteProtected = false;
@ -141,8 +141,8 @@ struct HDD
}
// From FloppyDisk
TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension) [not used]
TCHAR fullname[ MAX_DISK_FULL_NAME + 1 ]; // <FILENAME.EXT> or <FILENAME.zip>
std::string imagename; // <FILENAME> (ie. no extension) [not used]
std::string fullname; // <FILENAME.EXT> or <FILENAME.zip>
std::string strFilenameInZip; // "" or <FILENAME.EXT> [not used]
ImageInfo* imagehandle; // Init'd by HD_Insert() -> ImageOpen()
bool bWriteProtected; // Needed for ImageOpen() [otherwise not used]
@ -204,7 +204,7 @@ static void NotifyInvalidImage(TCHAR* pszImageFilename)
//===========================================================================
BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename);
BOOL HD_Insert(const int iDrive, const std::string & pszImageFilename);
void HD_LoadLastDiskImage(const int iDrive)
{
@ -233,7 +233,7 @@ static void HD_SaveLastDiskImage(const int iDrive)
if (!g_bSaveDiskImage)
return;
const char *pFileName = g_HardDisk[iDrive].fullname;
const std::string & pFileName = g_HardDisk[iDrive].fullname;
if (iDrive == HARDDISK_1)
RegSaveString(TEXT(REG_PREFS), REGVALUE_PREF_LAST_HARDDISK_1, TRUE, pFileName);
@ -243,7 +243,7 @@ static void HD_SaveLastDiskImage(const int iDrive)
//
char szPathName[MAX_PATH];
strcpy(szPathName, HD_GetFullPathName(iDrive));
strcpy(szPathName, HD_GetFullPathName(iDrive).c_str());
if (_tcsrchr(szPathName, TEXT('\\')))
{
char* pPathEnd = _tcsrchr(szPathName, TEXT('\\'))+1;
@ -296,17 +296,17 @@ void HD_SetEnabled(const bool bEnabled)
//-------------------------------------
LPCTSTR HD_GetFullName(const int iDrive)
const std::string & HD_GetFullName(const int iDrive)
{
return g_HardDisk[iDrive].fullname;
}
LPCTSTR HD_GetFullPathName(const int iDrive)
const std::string & HD_GetFullPathName(const int iDrive)
{
return ImageGetPathname(g_HardDisk[iDrive].imagehandle);
}
static LPCTSTR HD_DiskGetBaseName(const int iDrive) // Not used
static const std::string & HD_DiskGetBaseName(const int iDrive) // Not used
{
return g_HardDisk[iDrive].imagename;
}
@ -362,9 +362,9 @@ void HD_Destroy(void)
}
// Pre: pszImageFilename is qualified with path
BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename)
BOOL HD_Insert(const int iDrive, const std::string & pszImageFilename)
{
if (*pszImageFilename == 0x00)
if (pszImageFilename.empty())
return FALSE;
if (g_HardDisk[iDrive].hd_imageloaded)
@ -372,14 +372,14 @@ BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename)
// Check if image is being used by the other HDD, and unplug it in order to be swapped
{
const char* pszOtherPathname = HD_GetFullPathName(!iDrive);
const std::string & pszOtherPathname = HD_GetFullPathName(!iDrive);
char szCurrentPathname[MAX_PATH];
DWORD uNameLen = GetFullPathName(pszImageFilename, MAX_PATH, szCurrentPathname, NULL);
DWORD uNameLen = GetFullPathName(pszImageFilename.c_str(), MAX_PATH, szCurrentPathname, NULL);
if (uNameLen == 0 || uNameLen >= MAX_PATH)
strcpy_s(szCurrentPathname, MAX_PATH, pszImageFilename);
strcpy_s(szCurrentPathname, MAX_PATH, pszImageFilename.c_str());
if (!strcmp(pszOtherPathname, szCurrentPathname))
if (!strcmp(pszOtherPathname.c_str(), szCurrentPathname))
{
HD_Unplug(!iDrive);
FrameRefreshStatus(DRAW_LEDS);
@ -405,7 +405,7 @@ BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename)
if (Error == eIMAGE_ERROR_NONE)
{
GetImageTitle(pszImageFilename, g_HardDisk[iDrive].imagename, g_HardDisk[iDrive].fullname);
GetImageTitle(pszImageFilename.c_str(), g_HardDisk[iDrive].imagename, g_HardDisk[iDrive].fullname);
}
HD_SaveLastDiskImage(iDrive);
@ -846,7 +846,7 @@ bool HD_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, co
bool bResSelectImage2 = HD_LoadSnapshotHDDUnit(yamlLoadHelper, HARDDISK_2);
if (!bResSelectImage1 && !bResSelectImage2)
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, strSaveStatePath.c_str());
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, strSaveStatePath);
HD_SetEnabled(true);

View file

@ -33,12 +33,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
void HD_Destroy(void);
bool HD_CardIsEnabled(void);
void HD_SetEnabled(const bool bEnabled);
LPCTSTR HD_GetFullName(const int iDrive);
LPCTSTR HD_GetFullPathName(const int iDrive);
const std::string & HD_GetFullName(const int iDrive);
const std::string & HD_GetFullPathName(const int iDrive);
void HD_Reset(void);
void HD_Load_Rom(const LPBYTE pCxRomPeripheral, const UINT uSlot);
bool HD_Select(const int iDrive);
BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename);
BOOL HD_Insert(const int iDrive, const std::string & pszImageFilename);
void HD_Unplug(const int iDrive);
bool HD_IsDriveUnplugged(const int iDrive);
void HD_LoadLastDiskImage(const int iDrive);

View file

@ -1438,7 +1438,7 @@ void MemInitialize()
GetDesktopWindow(),
TEXT("The emulator was unable to allocate the memory it ")
TEXT("requires. Further execution is not possible."),
g_pAppTitle,
g_pAppTitle.c_str(),
MB_ICONSTOP | MB_SETFOREGROUND);
ExitProcess(1);
}
@ -1451,7 +1451,7 @@ void MemInitialize()
TEXT("system. While changing the attributes of a memory ")
TEXT("object, the operating system also changed its ")
TEXT("location."),
g_pAppTitle,
g_pAppTitle.c_str(),
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
// memimage has been freed
@ -1535,7 +1535,7 @@ void MemInitializeROM(void)
MessageBox(
GetDesktopWindow(),
sText,
g_pAppTitle,
g_pAppTitle.c_str(),
MB_ICONSTOP | MB_SETFOREGROUND);
ExitProcess(1);

View file

@ -42,7 +42,7 @@ static unsigned int g_PrinterIdleLimit = 10;
static FILE* file = NULL;
DWORD const PRINTDRVR_SIZE = APPLE_SLOT_SIZE;
#define DEFAULT_PRINT_FILENAME "Printer.txt"
static char g_szPrintFilename[MAX_PATH] = {0};
static std::string g_szPrintFilename;
bool g_bDumpToPrinter = false;
bool g_bConvertEncoding = true;
bool g_bFilterUnprintable = true;
@ -97,9 +97,9 @@ static BOOL CheckPrint()
//_tcsncat(filepath, _T("Printer.txt"), MAX_PATH);
//file = fopen(filepath, "wb");
if (g_bPrinterAppend )
file = fopen(Printer_GetFilename(), "ab");
file = fopen(Printer_GetFilename().c_str(), "ab");
else
file = fopen(Printer_GetFilename(), "wb");
file = fopen(Printer_GetFilename().c_str(), "wb");
}
return (file != NULL);
}
@ -228,32 +228,20 @@ static BYTE __stdcall PrintTransmit(WORD, WORD, BYTE, BYTE value, ULONG)
//===========================================================================
char* Printer_GetFilename()
const std::string & Printer_GetFilename()
{
return g_szPrintFilename;
}
void Printer_SetFilename(char* prtFilename)
void Printer_SetFilename(const std::string & prtFilename)
{
if (*prtFilename)
if (!prtFilename.empty())
{
strcpy(g_szPrintFilename, (const char *) prtFilename);
g_szPrintFilename = prtFilename;
}
else //No registry entry is available
{
_tcsncpy(g_szPrintFilename, g_sProgramDir, MAX_PATH);
g_szPrintFilename[MAX_PATH - 1] = 0;
// NB. _tcsncat_s() terminates program if buffer is too small! So continue to use manual buffer check & _tcsncat()
int nLen = sizeof(g_szPrintFilename) - strlen(g_szPrintFilename) - (sizeof(DEFAULT_PRINT_FILENAME)-1) - 1;
if (nLen < 0)
{
MessageBox(g_hFrameWindow, "Printer - SetFilename(): folder too deep", "Warning", MB_ICONWARNING | MB_OK);
return;
}
_tcsncat(g_szPrintFilename, DEFAULT_PRINT_FILENAME, sizeof(DEFAULT_PRINT_FILENAME)-1);
g_szPrintFilename = g_sProgramDir + DEFAULT_PRINT_FILENAME;
RegSaveString(REG_CONFIG, REGVALUE_PRINTER_FILENAME, 1, g_szPrintFilename);
}
}
@ -314,8 +302,7 @@ bool Printer_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT
inactivity = yamlLoadHelper.LoadUint(SS_YAML_KEY_INACTIVITY);
g_PrinterIdleLimit = yamlLoadHelper.LoadUint(SS_YAML_KEY_IDLELIMIT);
strncpy(g_szPrintFilename, yamlLoadHelper.LoadString(SS_YAML_KEY_FILENAME).c_str(), sizeof(g_szPrintFilename));
g_szPrintFilename[sizeof(g_szPrintFilename)-1] = 0;
g_szPrintFilename = yamlLoadHelper.LoadString(SS_YAML_KEY_FILENAME);
if (yamlLoadHelper.LoadBool(SS_YAML_KEY_FILEOPEN))
{

View file

@ -4,8 +4,8 @@ void PrintDestroy();
void PrintLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot);
void PrintReset();
void PrintUpdate(DWORD);
void Printer_SetFilename(char* pszFilename);
char* Printer_GetFilename();
void Printer_SetFilename(const std::string & pszFilename);
const std::string & Printer_GetFilename();
void Printer_SetIdleLimit(unsigned int Duration);
unsigned int Printer_GetIdleLimit();

View file

@ -87,7 +87,7 @@ BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value, DWO
}
//===========================================================================
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer) {
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer) {
TCHAR fullkeyname[256];
StringCbPrintf(fullkeyname, 256, TEXT("Software\\AppleWin\\CurrentVersion\\%s"), section);
@ -110,8 +110,8 @@ void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer)
key,
0,
REG_SZ,
(CONST LPBYTE)buffer,
(_tcslen(buffer) + 1) * sizeof(TCHAR));
(CONST LPBYTE)buffer.c_str(),
(buffer.size() + 1) * sizeof(TCHAR));
RegCloseKey(keyhandle);
}
}

View file

@ -8,5 +8,5 @@ BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, D
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars, LPCTSTR defaultValue);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value, DWORD defaultValue);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer);
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value);

View file

@ -74,7 +74,7 @@ static YamlHelper yamlHelper;
//-----------------------------------------------------------------------------
void Snapshot_SetFilename(std::string strPathname)
void Snapshot_SetFilename(const std::string & strPathname)
{
if (strPathname.empty())
{
@ -104,14 +104,14 @@ void Snapshot_SetFilename(std::string strPathname)
g_strSaveStatePathname = strPathname;
}
const char* Snapshot_GetFilename()
const std::string & Snapshot_GetFilename()
{
return g_strSaveStateFilename.c_str();
return g_strSaveStateFilename;
}
const char* Snapshot_GetPath()
const std::string & Snapshot_GetPath()
{
return g_strSaveStatePath.c_str();
return g_strSaveStatePath;
}
//-----------------------------------------------------------------------------

View file

@ -2,9 +2,9 @@
extern bool g_bSaveStateOnExit;
void Snapshot_SetFilename(std::string strPathname);
const char* Snapshot_GetFilename();
const char* Snapshot_GetPath();
void Snapshot_SetFilename(const std::string & strPathname);
const std::string & Snapshot_GetFilename();
const std::string & Snapshot_GetPath();
void Snapshot_LoadState();
void Snapshot_SaveState();
void Snapshot_Startup();

View file

@ -70,7 +70,7 @@ CSuperSerialCard::CSuperSerialCard() :
m_uSlot(0),
m_bCfgSupportDCD(false)
{
memset(m_ayCurrentSerialPortName, 0, sizeof(m_ayCurrentSerialPortName));
m_ayCurrentSerialPortName.clear();
m_dwSerialPortItem = 0;
m_hCommHandle = INVALID_HANDLE_VALUE;
@ -966,11 +966,14 @@ void CSuperSerialCard::CommSetSerialPort(HWND hWindow, DWORD dwNewSerialPortItem
m_dwSerialPortItem = dwNewSerialPortItem;
if (m_dwSerialPortItem == m_uTCPChoiceItemIdx)
strcpy(m_ayCurrentSerialPortName, TEXT_SERIAL_TCP);
else if (m_dwSerialPortItem != 0)
sprintf(m_ayCurrentSerialPortName, TEXT_SERIAL_COM"%d", m_vecSerialPortsItems[m_dwSerialPortItem]);
m_ayCurrentSerialPortName = TEXT_SERIAL_TCP;
else if (m_dwSerialPortItem != 0) {
TCHAR temp[SIZEOF_SERIALCHOICE_ITEM];
sprintf(temp, TEXT_SERIAL_COM"%d", m_vecSerialPortsItems[m_dwSerialPortItem]);
m_ayCurrentSerialPortName = temp;
}
else
m_ayCurrentSerialPortName[0] = 0; // "None"
m_ayCurrentSerialPortName.clear(); // "None"
}
//===========================================================================
@ -1315,8 +1318,7 @@ char* CSuperSerialCard::GetSerialPortChoices()
// Called by LoadConfiguration()
void CSuperSerialCard::SetSerialPortName(const char* pSerialPortName)
{
strncpy(m_ayCurrentSerialPortName, pSerialPortName, SIZEOF_SERIALCHOICE_ITEM);
m_ayCurrentSerialPortName[SIZEOF_SERIALCHOICE_ITEM-1] = 0;
m_ayCurrentSerialPortName = pSerialPortName;
// Init m_aySerialPortChoices, so that we have choices to show if serial is active when we 1st open Config dialog
GetSerialPortChoices();
@ -1348,7 +1350,7 @@ void CSuperSerialCard::SetSerialPortName(const char* pSerialPortName)
}
else
{
m_ayCurrentSerialPortName[0] = 0; // "None"
m_ayCurrentSerialPortName.clear(); // "None"
m_dwSerialPortItem = 0;
}
}

View file

@ -38,7 +38,7 @@ public:
char* GetSerialPortChoices();
DWORD GetSerialPort() { return m_dwSerialPortItem; } // Drop-down list item
char* GetSerialPortName() { return m_ayCurrentSerialPortName; }
const std::string & GetSerialPortName() { return m_ayCurrentSerialPortName; }
void SetSerialPortName(const char* pSerialPortName);
bool IsActive() { return (m_hCommHandle != INVALID_HANDLE_VALUE) || (m_hCommListenSocket != INVALID_SOCKET); }
void SupportDCD(bool bEnable) { m_bCfgSupportDCD = bEnable; } // Status
@ -86,7 +86,7 @@ public:
static const UINT SIZEOF_SERIALCHOICE_ITEM = 8*sizeof(char);
private:
char m_ayCurrentSerialPortName[SIZEOF_SERIALCHOICE_ITEM];
std::string m_ayCurrentSerialPortName;
DWORD m_dwSerialPortItem;
static const UINT SERIALPORTITEM_INVALID_COM_PORT = 0;

View file

@ -968,10 +968,10 @@ void DDUninit(void)
static int g_nLastScreenShot = 0;
const int nMaxScreenShot = 999999999;
static TCHAR *g_pLastDiskImageName = NULL;
static std::string g_pLastDiskImageName;
//===========================================================================
void Video_ResetScreenshotCounter( TCHAR *pImageName )
void Video_ResetScreenshotCounter( const std::string & pImageName )
{
g_nLastScreenShot = 0;
g_pLastDiskImageName = pImageName;
@ -980,14 +980,14 @@ void Video_ResetScreenshotCounter( TCHAR *pImageName )
//===========================================================================
void Util_MakeScreenShotFileName( TCHAR *pFinalFileName_, DWORD chars )
{
const TCHAR * sPrefixScreenShotFileName = "AppleWin_ScreenShot";
const std::string sPrefixScreenShotFileName = "AppleWin_ScreenShot";
// TODO: g_sScreenshotDir
const TCHAR *pPrefixFileName = g_pLastDiskImageName ? g_pLastDiskImageName : sPrefixScreenShotFileName;
const std::string pPrefixFileName = !g_pLastDiskImageName.empty() ? g_pLastDiskImageName : sPrefixScreenShotFileName;
#if SCREENSHOT_BMP
StringCbPrintf( pFinalFileName_, chars, TEXT("%s_%09d.bmp"), pPrefixFileName, g_nLastScreenShot );
StringCbPrintf( pFinalFileName_, chars, TEXT("%s_%09d.bmp"), pPrefixFileName.c_str(), g_nLastScreenShot );
#endif
#if SCREENSHOT_TGA
StringCbPrintf( pFinalFileName_, chars, TEXT("%s%09d.tga"), pPrefixFileName, g_nLastScreenShot );
StringCbPrintf( pFinalFileName_, chars, TEXT("%s%09d.tga"), pPrefixFileName.c_str(), g_nLastScreenShot );
#endif
}

View file

@ -205,7 +205,7 @@ void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
extern bool g_bDisplayPrintScreenFileName;
extern bool g_bShowPrintScreenWarningDialog;
void Video_ResetScreenshotCounter( char *pDiskImageFileName );
void Video_ResetScreenshotCounter( const std::string & pDiskImageFileName );
enum VideoScreenShot_e
{
SCREENSHOT_560x384 = 0,

View file

@ -442,6 +442,11 @@ void YamlSaveHelper::SaveString(const char* key, const char* value)
Save("%s: %s\n", key, (value[0] != 0) ? value : "\"\"");
}
void YamlSaveHelper::SaveString(const char* key, const std::string & value)
{
SaveString(key, value.c_str());
}
void YamlSaveHelper::SaveFloat(const char* key, float value)
{
Save("%s: %f\n", key, value);

View file

@ -216,6 +216,7 @@ public:
void SaveHexUint64(const char* key, UINT64 value);
void SaveBool(const char* key, bool value);
void SaveString(const char* key, const char* value);
void SaveString(const char* key, const std::string & value);
void SaveFloat(const char* key, float value);
void SaveDouble(const char* key, double value);
void SaveMemory(const LPBYTE pMemBase, const UINT uMemSize);