Replace some char * with std::string.
This commit is contained in:
parent
ed9ae72778
commit
d5890e8356
16 changed files with 85 additions and 109 deletions
|
@ -80,7 +80,7 @@ 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
|
||||
std::string g_sProgramDir; // 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
|
||||
bool g_bCapturePrintScreenKey = true;
|
||||
|
@ -472,15 +472,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); // this reduces the size
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ bool GetLoadedSaveStateFlag(void);
|
|||
void SetLoadedSaveStateFlag(const bool bFlag);
|
||||
bool GetHookAltGrControl(void);
|
||||
|
||||
extern TCHAR g_sProgramDir[MAX_PATH];
|
||||
extern std::string g_sProgramDir;
|
||||
extern TCHAR g_sCurrentDir[MAX_PATH];
|
||||
|
||||
extern bool g_bRestart;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -182,7 +182,7 @@ void CPageAdvanced::DlgOK(HWND hWnd)
|
|||
szFilename[nLineLength] = 0x00;
|
||||
|
||||
Printer_SetFilename(szFilename);
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_PRINTER_FILENAME, 1, Printer_GetFilename());
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_PRINTER_FILENAME, 1, Printer_GetFilename().c_str());
|
||||
}
|
||||
|
||||
g_bSaveStateOnExit = IsDlgButtonChecked(hWnd, IDC_SAVESTATE_ON_EXIT) ? true : false;
|
||||
|
|
|
@ -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
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
@ -2394,9 +2394,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,
|
||||
|
@ -4768,8 +4766,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 );
|
||||
|
@ -4791,7 +4788,7 @@ Update_t CmdMemorySave (int nArgs)
|
|||
{
|
||||
_tcscpy( 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 +4797,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 +4805,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 );
|
||||
|
@ -5631,8 +5628,7 @@ 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 );
|
||||
|
@ -5644,16 +5640,16 @@ int CmdTextSave (int nArgs)
|
|||
sprintf( 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 );
|
||||
|
@ -6518,11 +6514,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 +6736,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 +6751,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 int MAX_MINI_FILENAME = 20;
|
||||
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 +6784,7 @@ Update_t CmdSource (int nArgs)
|
|||
}
|
||||
else
|
||||
{
|
||||
ConsoleBufferPushFormat( sFileName, "Error reading: %s", sMiniFileName );
|
||||
ConsoleBufferPushFormat( buffer, "Error reading: %s", sMiniFileName.c_str() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7659,7 +7652,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 +7716,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 +8439,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)
|
||||
{
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_ )
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,33 +228,21 @@ 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);
|
||||
RegSaveString(REG_CONFIG, REGVALUE_PRINTER_FILENAME, 1, g_szPrintFilename);
|
||||
g_szPrintFilename = g_sProgramDir + DEFAULT_PRINT_FILENAME;
|
||||
RegSaveString(REG_CONFIG, REGVALUE_PRINTER_FILENAME, 1, g_szPrintFilename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue