win32: fix newlines in action replay cheats edit, and fix sticky pause condition when resetting or loading games

This commit is contained in:
zeromus 2009-12-20 17:19:32 +00:00
parent 8941b4aba9
commit 0490039779
3 changed files with 12 additions and 4 deletions

View File

@ -589,7 +589,10 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
std::string answer = source;
std::string::size_type j = 0;
while ((j = answer.find(victim, j)) != std::string::npos )
answer.replace(j, victim.length(), replacement);
{
answer.replace(j, victim.length(), replacement);
j+= replacement.length();
}
return answer;
}

View File

@ -22,6 +22,7 @@
#include "../cheatSystem.h"
#include "resource.h"
#include "../debug.h"
#include "../utils/xstring.h"
static u8 searchType = 0;
static u8 searchSize = 0;
@ -566,7 +567,8 @@ INT_PTR CALLBACK CheatsAdd_XX_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lp
memset(buf, 0, sizeof(buf));
cheats->getXXcodeString(tempCheat, buf);
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf);
std::string bufstr = mass_replace(buf,"\n","\r\n");
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), bufstr.c_str());
SetWindowText(GetDlgItem(dialog, IDC_EDIT3), tempCheat.description);
EnableWindow(GetDlgItem(dialog, IDOK), (strlen(buf) > 16)?TRUE:FALSE);

View File

@ -3031,7 +3031,7 @@ static BOOL OpenCore(const char* filename)
if(LoadROM(filename, LogicalName))
{
romloaded = TRUE;
NDS_UnPause();
Unpause();
return TRUE;
}
else return FALSE;
@ -5597,7 +5597,10 @@ static LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam
void ResetGame()
{
if(movieMode != MOVIEMODE_PLAY)
NDS_Reset();
{
NDS_Reset();
Unpause();
}
}
//adelikat: This function changes a menu item's text