varous bugfixes, xstring trimming functions logic bugs, etc
some refactoring, some wtfs... ;)
This commit is contained in:
parent
125173107b
commit
565f063fa5
|
@ -15,8 +15,8 @@ int Assemble(unsigned char *output, int addr, char *str) {
|
||||||
//unsigned char opcode[3] = { 0,0,0 };
|
//unsigned char opcode[3] = { 0,0,0 };
|
||||||
output[0] = output[1] = output[2] = 0;
|
output[0] = output[1] = output[2] = 0;
|
||||||
char astr[128],ins[4];
|
char astr[128],ins[4];
|
||||||
|
int len = strlen(str);
|
||||||
if ((!strlen(str)) || (strlen(str) > 0x127)) return 1;
|
if ((!len) || (len > 0x127)) return 1;
|
||||||
|
|
||||||
strcpy(astr,str);
|
strcpy(astr,str);
|
||||||
str_ucase(astr);
|
str_ucase(astr);
|
||||||
|
@ -211,7 +211,7 @@ int Assemble(unsigned char *output, int addr, char *str) {
|
||||||
output[2] = (tmpint >> 8);
|
output[2] = (tmpint >> 8);
|
||||||
}
|
}
|
||||||
else { //Zero Page
|
else { //Zero Page
|
||||||
if ((output[0] != 0x86) || (output[0] != 0xA2)) return 1; //only STX and LDX Absolute,Y!
|
if ((output[0] != 0x86) && (output[0] != 0xA2)) return 1; //only STX and LDX Absolute,Y!
|
||||||
output[0] |= 0x10;
|
output[0] |= 0x10;
|
||||||
output[1] = (tmpint & 0xFF);
|
output[1] = (tmpint & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,7 @@ int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
if((t=(char *)realloc(next->name,strlen(name+1))))
|
if((t=(char *)realloc(next->name,strlen(name)+1)))
|
||||||
{
|
{
|
||||||
next->name=t;
|
next->name=t;
|
||||||
strcpy(next->name,name);
|
strcpy(next->name,name);
|
||||||
|
|
|
@ -228,7 +228,7 @@ int getBank(int offs)
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetNesFileAddress(int A){
|
int GetNesFileAddress(int A){
|
||||||
unsigned int result;
|
int result;
|
||||||
if((A < 0x8000) || (A > 0xFFFF))return -1;
|
if((A < 0x8000) || (A > 0xFFFF))return -1;
|
||||||
result = &Page[A>>11][A]-PRGptr[0];
|
result = &Page[A>>11][A]-PRGptr[0];
|
||||||
if((result > PRGsize[0]) || (result < 0))return -1;
|
if((result > PRGsize[0]) || (result < 0))return -1;
|
||||||
|
|
|
@ -478,7 +478,7 @@ int *GetEditHexData(HWND hwndDlg, int id){
|
||||||
int i,j, k;
|
int i,j, k;
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg,id,str,60);
|
GetDlgItemText(hwndDlg,id,str,60);
|
||||||
memset(data,0,30*sizeof(int));
|
memset(data,0,31*sizeof(int));
|
||||||
j=0;
|
j=0;
|
||||||
for(i = 0;i < 60;i++){
|
for(i = 0;i < 60;i++){
|
||||||
if(str[i] == 0)break;
|
if(str[i] == 0)break;
|
||||||
|
|
|
@ -11,30 +11,30 @@
|
||||||
void CenterWindow(HWND hwndDlg)
|
void CenterWindow(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
//TODO: This function should probably moved into the generic Win32 window file
|
//TODO: This function should probably moved into the generic Win32 window file
|
||||||
//move the window relative to its parent
|
//move the window relative to its parent
|
||||||
HWND hwndParent = GetParent(hwndDlg);
|
HWND hwndParent = GetParent(hwndDlg);
|
||||||
RECT rect;
|
RECT rect;
|
||||||
RECT rectP;
|
RECT rectP;
|
||||||
|
|
||||||
GetWindowRect(hwndDlg, &rect);
|
GetWindowRect(hwndDlg, &rect);
|
||||||
GetWindowRect(hwndParent, &rectP);
|
GetWindowRect(hwndParent, &rectP);
|
||||||
|
|
||||||
unsigned int width = rect.right - rect.left;
|
int width = rect.right - rect.left;
|
||||||
unsigned height = rect.bottom - rect.top;
|
int height = rect.bottom - rect.top;
|
||||||
|
|
||||||
unsigned x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
|
int x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
|
||||||
unsigned y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
|
int y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
|
||||||
|
|
||||||
unsigned int screenwidth = GetSystemMetrics(SM_CXSCREEN);
|
int screenwidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
unsigned int screenheight = GetSystemMetrics(SM_CYSCREEN);
|
int screenheight = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
//make sure that the dialog box never moves outside of the screen
|
//make sure that the dialog box never moves outside of the screen
|
||||||
if(x < 0) x = 0;
|
if(x < 0) x = 0;
|
||||||
if(y < 0) y = 0;
|
if(y < 0) y = 0;
|
||||||
if(x + width > screenwidth) x = screenwidth - width;
|
if(x + width > screenwidth) x = screenwidth - width;
|
||||||
if(y + height > screenheight) y = screenheight - height;
|
if(y + height > screenheight) y = screenheight - height;
|
||||||
|
|
||||||
MoveWindow(hwndDlg, x, y, width, height, FALSE);
|
MoveWindow(hwndDlg, x, y, width, height, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1691,22 +1691,21 @@ static void PresetImport(int preset)
|
||||||
{
|
{
|
||||||
//Save the directory
|
//Save the directory
|
||||||
if(ofn.nFileOffset < 1024)
|
if(ofn.nFileOffset < 1024)
|
||||||
if(ofn.nFileOffset < 1024)
|
{
|
||||||
{
|
free(InputPresetDir);
|
||||||
free(InputPresetDir);
|
InputPresetDir=(char*)malloc(strlen(ofn.lpstrFile)+1);
|
||||||
InputPresetDir=(char*)malloc(strlen(ofn.lpstrFile)+1);
|
strcpy(InputPresetDir,ofn.lpstrFile);
|
||||||
strcpy(InputPresetDir,ofn.lpstrFile);
|
InputPresetDir[ofn.nFileOffset]=0;
|
||||||
InputPresetDir[ofn.nFileOffset]=0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FILE *fp=FCEUD_UTF8fopen(nameo,"r");
|
FILE *fp=FCEUD_UTF8fopen(nameo,"r");
|
||||||
switch(preset)
|
switch(preset)
|
||||||
{
|
{
|
||||||
case 1: fread(GamePadPreset1,1,sizeof(GamePadPreset1),fp); break;
|
case 1: fread(GamePadPreset1,1,sizeof(GamePadPreset1),fp); break;
|
||||||
case 2: fread(GamePadPreset2,1,sizeof(GamePadPreset2),fp); break;
|
case 2: fread(GamePadPreset2,1,sizeof(GamePadPreset2),fp); break;
|
||||||
case 3: fread(GamePadPreset3,1,sizeof(GamePadPreset3),fp); break;
|
case 3: fread(GamePadPreset3,1,sizeof(GamePadPreset3),fp); break;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
SetThreadAffinityMask(GetCurrentThread(),1);
|
SetThreadAffinityMask(GetCurrentThread(),1);
|
||||||
|
|
||||||
printf("%08x",opsize);
|
//printf("%08x",opsize); //AGAIN?!
|
||||||
|
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ doloopy:
|
||||||
if(closeGame)
|
if(closeGame)
|
||||||
{
|
{
|
||||||
FCEUI_CloseGame();
|
FCEUI_CloseGame();
|
||||||
GameInfo = 0;
|
GameInfo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,7 +683,7 @@ void UnfreezeAllRam() {
|
||||||
// would be added by the freeze command. Manual unfreeze should let them
|
// would be added by the freeze command. Manual unfreeze should let them
|
||||||
// make that mistake once or twice, in case they like it that way.
|
// make that mistake once or twice, in case they like it that way.
|
||||||
FCEUI_GetCheat(i,&Cname,&Caddr,NULL,NULL,NULL,&Ctype);
|
FCEUI_GetCheat(i,&Cname,&Caddr,NULL,NULL,NULL,&Ctype);
|
||||||
if ((Cname[0] == '\0') && (((Caddr >= 0) && (Caddr < 0x2000)) || ((Caddr >= 0x6000) && (Caddr < 0x8000))) && (Ctype == 1)) {
|
if ((Cname[0] == '\0') && ((Caddr < 0x2000) || ((Caddr >= 0x6000) && (Caddr < 0x8000))) && (Ctype == 1)) {
|
||||||
// Already Added, so consider it a success
|
// Already Added, so consider it a success
|
||||||
FreezeRam(Caddr,-1,1);
|
FreezeRam(Caddr,-1,1);
|
||||||
|
|
||||||
|
|
|
@ -708,7 +708,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
EnableMenuItem(memwmenu,MEMW_FILE_SAVE,MF_BYCOMMAND | fileChanged ? MF_ENABLED:MF_GRAYED);
|
EnableMenuItem(memwmenu,MEMW_FILE_SAVE,MF_BYCOMMAND | (fileChanged ? MF_ENABLED : MF_GRAYED));
|
||||||
break;
|
break;
|
||||||
case WM_MOVE: {
|
case WM_MOVE: {
|
||||||
if (!IsIconic(hwndDlg)) {
|
if (!IsIconic(hwndDlg)) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ BOOL updateResults(HWND hwndDlg, int rule)
|
||||||
|
|
||||||
if ( chosen_rules[i] == RULE_EXACT || chosen_rules[i] == RULE_EXACT_NOT )
|
if ( chosen_rules[i] == RULE_EXACT || chosen_rules[i] == RULE_EXACT_NOT )
|
||||||
{
|
{
|
||||||
SendDlgItemMessage( hwndDlg, RULE_INPUT_1 + i, WM_GETTEXT, sizeof(buff - 1), (LPARAM) input_buff );
|
SendDlgItemMessage( hwndDlg, RULE_INPUT_1 + i, WM_GETTEXT, sizeof(buff) - 1, (LPARAM) input_buff );
|
||||||
|
|
||||||
unsigned int len = strlen(input_buff);
|
unsigned int len = strlen(input_buff);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool IsHardwareAddressValid(HWAddressType address)
|
||||||
if (!GameInfo)
|
if (!GameInfo)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((address >= 0x0000 && address <= 0x07ff) || (address >= 0x6000 && address <= 0x7FFF))
|
if ((address <= 0x07ff) || (address >= 0x6000 && address <= 0x7FFF))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -874,10 +874,10 @@ bool Set_RS_Val()
|
||||||
appliedSize = 'w', appliedSign = 'u';
|
appliedSize = 'w', appliedSign = 'u';
|
||||||
if(rs_c == 'a')
|
if(rs_c == 'a')
|
||||||
appliedSize = 'd', appliedSign = 'u';
|
appliedSize = 'd', appliedSign = 'u';
|
||||||
if((appliedSize == 'b' && appliedSize == 's' && (rs_param < -128 || rs_param > 127)) ||
|
if((appliedSize == 'b' && appliedSign == 's' && (rs_param < -128 || rs_param > 127)) ||
|
||||||
(appliedSize == 'b' && appliedSize != 's' && (rs_param < 0 || rs_param > 255)) ||
|
(appliedSize == 'b' && appliedSign != 's' && (rs_param < 0 || rs_param > 255)) ||
|
||||||
(appliedSize == 'w' && appliedSize == 's' && (rs_param < -32768 || rs_param > 32767)) ||
|
(appliedSize == 'w' && appliedSign == 's' && (rs_param < -32768 || rs_param > 32767)) ||
|
||||||
(appliedSize == 'w' && appliedSize != 's' && (rs_param < 0 || rs_param > 65535)))
|
(appliedSize == 'w' && appliedSign != 's' && (rs_param < 0 || rs_param > 65535)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@ extern bool RWfileChanged;
|
||||||
struct AddressWatcher
|
struct AddressWatcher
|
||||||
{
|
{
|
||||||
unsigned int Address; // hardware address
|
unsigned int Address; // hardware address
|
||||||
char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator.
|
unsigned int CurValue;
|
||||||
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'S' = separator
|
|
||||||
char* comment; // NULL means no comment, non-NULL means allocated comment
|
char* comment; // NULL means no comment, non-NULL means allocated comment
|
||||||
bool WrongEndian;
|
bool WrongEndian;
|
||||||
unsigned int CurValue;
|
char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator.
|
||||||
|
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'S' = separator
|
||||||
};
|
};
|
||||||
#define MAX_WATCH_COUNT 256
|
#define MAX_WATCH_COUNT 256
|
||||||
extern AddressWatcher rswatches[MAX_WATCH_COUNT];
|
extern AddressWatcher rswatches[MAX_WATCH_COUNT];
|
||||||
|
|
|
@ -965,7 +965,7 @@ void FCEUD_MovieRecordTo()
|
||||||
if(loadStateFailed)
|
if(loadStateFailed)
|
||||||
{
|
{
|
||||||
char str [1024];
|
char str [1024];
|
||||||
sprintf(str, "Failed to load save state \"%s\".\nRecording from current state instead...", p.szSavestateFilename);
|
sprintf(str, "Failed to load save state \"%s\".\nRecording from current state instead...", p.szSavestateFilename.c_str());
|
||||||
FCEUD_PrintError(str);
|
FCEUD_PrintError(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,6 @@ void SELECTION::saveSelection(SelectionFrames& selection, EMUFILE *os)
|
||||||
bool SELECTION::loadSelection(SelectionFrames& selection, EMUFILE *is)
|
bool SELECTION::loadSelection(SelectionFrames& selection, EMUFILE *is)
|
||||||
{
|
{
|
||||||
int temp_int, temp_size;
|
int temp_int, temp_size;
|
||||||
selection.clear();
|
|
||||||
if (!read32le(&temp_size, is)) return true;
|
if (!read32le(&temp_size, is)) return true;
|
||||||
selection.clear();
|
selection.clear();
|
||||||
for(; temp_size > 0; temp_size--)
|
for(; temp_size > 0; temp_size--)
|
||||||
|
|
|
@ -345,8 +345,8 @@ void TextHookerUnloadTableFile(){
|
||||||
|
|
||||||
//clear the selections hash holder
|
//clear the selections hash holder
|
||||||
if ( hashholder != NULL ) {
|
if ( hashholder != NULL ) {
|
||||||
memset( hashholder, 0, sizeof( hashholder ) );
|
|
||||||
free( hashholder );
|
free( hashholder );
|
||||||
|
hashholder = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there are words...
|
//if there are words...
|
||||||
|
@ -739,7 +739,7 @@ int TextHookerSaveTableFile(){
|
||||||
|
|
||||||
//write the selection hashes to the file
|
//write the selection hashes to the file
|
||||||
for ( i = 0; i < numselections; i++ ) {
|
for ( i = 0; i < numselections; i++ ) {
|
||||||
memset( str, 0, 365 ); //init str
|
memset( str, 0, sizeof( str ) ); //init str
|
||||||
SendDlgItemMessage(hTextHooker,109,CB_GETLBTEXT,i,(LPARAM)(LPTSTR)str); //get the selection name
|
SendDlgItemMessage(hTextHooker,109,CB_GETLBTEXT,i,(LPARAM)(LPTSTR)str); //get the selection name
|
||||||
fputs( str, FP ); //write the name
|
fputs( str, FP ); //write the name
|
||||||
fputs( "=", FP ); //write the =
|
fputs( "=", FP ); //write the =
|
||||||
|
@ -797,8 +797,8 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
int si;
|
int si;
|
||||||
int saveFileErrorCheck = 0; //used to display error message that may have arised from saving a file
|
int saveFileErrorCheck = 0; //used to display error message that may have arised from saving a file
|
||||||
|
|
||||||
memset( str, 0, sizeof( char ) * 2048 );
|
memset( str, 0, sizeof( str ) );
|
||||||
memset( bufferstr, 0, sizeof( char ) * 10240 );
|
memset( bufferstr, 0, sizeof( bufferstr ));
|
||||||
|
|
||||||
switch(uMsg) {
|
switch(uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
@ -854,7 +854,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
else
|
else
|
||||||
sprintf( str, "Table is not Loaded!\r\nError on line: %d", result );
|
sprintf( str, "Table is not Loaded!\r\nError on line: %d", result );
|
||||||
//store the current text into the buffer
|
//store the current text into the buffer
|
||||||
GetDlgItemText(hwndDlg,102,bufferstr,10240);
|
GetDlgItemText(hwndDlg,102,bufferstr,sizeof( bufferstr ));
|
||||||
strcat( bufferstr, "\r\n" ); //add a newline
|
strcat( bufferstr, "\r\n" ); //add a newline
|
||||||
strcat( bufferstr, str ); //add the status message to the buffer
|
strcat( bufferstr, str ); //add the status message to the buffer
|
||||||
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
||||||
|
@ -995,7 +995,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
|
|
||||||
//store the current text into the buffer
|
//store the current text into the buffer
|
||||||
GetDlgItemText(hwndDlg,102,bufferstr,10240);
|
GetDlgItemText(hwndDlg,102,bufferstr,sizeof( bufferstr ));
|
||||||
strcat( bufferstr, "\r\n" ); //add a newline
|
strcat( bufferstr, "\r\n" ); //add a newline
|
||||||
strcat( bufferstr, str ); //add the status message to the buffer
|
strcat( bufferstr, str ); //add the status message to the buffer
|
||||||
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
||||||
|
@ -1103,7 +1103,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
current = words->next; //get the first word
|
current = words->next; //get the first word
|
||||||
while ( current != NULL ) { //while there's still words to check
|
while ( current != NULL ) { //while there's still words to check
|
||||||
found = strstr( str, current->ja ); //search the buffer for the word
|
found = strstr( str, current->ja ); //search the buffer for the word
|
||||||
memset( bufferstrtemp, 0, sizeof( str ) ); //init the temp buffer
|
memset( bufferstrtemp, 0, sizeof( bufferstrtemp ) ); //init the temp buffer
|
||||||
if ( found ) { //if we found it, replace it
|
if ( found ) { //if we found it, replace it
|
||||||
//add a null byte after the first half
|
//add a null byte after the first half
|
||||||
strcpy( (char*)found, "\0" );
|
strcpy( (char*)found, "\0" );
|
||||||
|
@ -1130,7 +1130,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
|
|
||||||
//store the current text into the buffer
|
//store the current text into the buffer
|
||||||
GetDlgItemText(hwndDlg,102,bufferstr,10240);
|
GetDlgItemText(hwndDlg,102,bufferstr,sizeof( bufferstr ));
|
||||||
strcat( bufferstr, "\r\n" ); //add a newline
|
strcat( bufferstr, "\r\n" ); //add a newline
|
||||||
strcat( bufferstr, str ); //add the hooked text to the buffer
|
strcat( bufferstr, str ); //add the hooked text to the buffer
|
||||||
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
SetDlgItemText(hwndDlg,102,bufferstr); //display the buffer
|
||||||
|
@ -1175,7 +1175,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
if ( !found ) {
|
if ( !found ) {
|
||||||
found = strstr( str, "\r\n" ); //and also for newlines
|
found = strstr( str, "\r\n" ); //and also for newlines
|
||||||
}
|
}
|
||||||
memset( bufferstrtemp, 0, sizeof( str ) ); //init the temp buffer
|
memset( bufferstrtemp, 0, sizeof( bufferstrtemp ) ); //init the temp buffer
|
||||||
if ( found ) { //found something to replace!
|
if ( found ) { //found something to replace!
|
||||||
//add a null byte after the first half
|
//add a null byte after the first half
|
||||||
strcpy( (char*)found, "\0" );
|
strcpy( (char*)found, "\0" );
|
||||||
|
|
|
@ -462,7 +462,7 @@ void UpdateContextMenuItems(HMENU context, int whichContext)
|
||||||
string undoSavestate = "Undo savestate";
|
string undoSavestate = "Undo savestate";
|
||||||
string redoSavestate = "Redo savestate";
|
string redoSavestate = "Redo savestate";
|
||||||
|
|
||||||
CheckMenuItem(context,ID_CONTEXT_FULLSAVESTATES,MF_BYCOMMAND | fullSaveStateLoads?MF_CHECKED:MF_UNCHECKED);
|
CheckMenuItem(context,ID_CONTEXT_FULLSAVESTATES,MF_BYCOMMAND | (fullSaveStateLoads ? MF_CHECKED : MF_UNCHECKED));
|
||||||
|
|
||||||
//Undo Loadstate
|
//Undo Loadstate
|
||||||
if (CheckBackupSaveStateExist() && (undoLS || redoLS))
|
if (CheckBackupSaveStateExist() && (undoLS || redoLS))
|
||||||
|
@ -1005,8 +1005,8 @@ void CloseGame()
|
||||||
{
|
{
|
||||||
FCEUI_CloseGame();
|
FCEUI_CloseGame();
|
||||||
KillMemView();
|
KillMemView();
|
||||||
updateGameDependentMenus(GameInfo != 0);
|
updateGameDependentMenus(1);
|
||||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
updateGameDependentMenusDebugger(1);
|
||||||
SetMainWindowText();
|
SetMainWindowText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1067,7 +1067,7 @@ bool ALoad(char *nameo, char* innerFilename)
|
||||||
|
|
||||||
updateGameDependentMenus(GameInfo != 0);
|
updateGameDependentMenus(GameInfo != 0);
|
||||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
updateGameDependentMenusDebugger(GameInfo != 0);
|
||||||
EmulationPaused = oldPaused;
|
EmulationPaused = oldPaused;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ FCEUGI::FCEUGI()
|
||||||
: filename(0)
|
: filename(0)
|
||||||
, archiveFilename(0)
|
, archiveFilename(0)
|
||||||
{
|
{
|
||||||
printf("%08x",opsize);
|
//printf("%08x",opsize); // WTF?!
|
||||||
}
|
}
|
||||||
|
|
||||||
FCEUGI::~FCEUGI()
|
FCEUGI::~FCEUGI()
|
||||||
|
@ -177,7 +177,7 @@ static void FCEU_CloseGame(void)
|
||||||
CloseGenie();
|
CloseGenie();
|
||||||
|
|
||||||
delete GameInfo;
|
delete GameInfo;
|
||||||
GameInfo = 0;
|
GameInfo = NULL;
|
||||||
|
|
||||||
currFrameCounter = 0;
|
currFrameCounter = 0;
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ static void FCEU_CloseGame(void)
|
||||||
uint64 timestampbase;
|
uint64 timestampbase;
|
||||||
|
|
||||||
|
|
||||||
FCEUGI *GameInfo = 0;
|
FCEUGI *GameInfo = NULL;
|
||||||
|
|
||||||
void (*GameInterface)(GI h);
|
void (*GameInterface)(GI h);
|
||||||
void (*GameStateRestore)(int version);
|
void (*GameStateRestore)(int version);
|
||||||
|
|
|
@ -81,7 +81,7 @@ static uint8 *diskdata[8]={0,0,0,0,0,0,0,0};
|
||||||
static int TotalSides; //mbg merge 7/17/06 - unsignedectomy
|
static int TotalSides; //mbg merge 7/17/06 - unsignedectomy
|
||||||
static uint8 DiskWritten=0; /* Set to 1 if disk was written to. */
|
static uint8 DiskWritten=0; /* Set to 1 if disk was written to. */
|
||||||
static uint8 writeskip;
|
static uint8 writeskip;
|
||||||
static uint32 DiskPtr;
|
static int32 DiskPtr;
|
||||||
static int32 DiskSeekIRQ;
|
static int32 DiskSeekIRQ;
|
||||||
static uint8 SelectDisk,InDisk;
|
static uint8 SelectDisk,InDisk;
|
||||||
|
|
||||||
|
|
|
@ -881,12 +881,10 @@ int iNesSaveAs(char* name)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if(GameInfo->type != GIT_CART)return 0;
|
if(GameInfo->type != GIT_CART)return 0;
|
||||||
if(GameInterface!=iNESGI)return 0;
|
if(GameInterface != iNESGI)return 0;
|
||||||
|
|
||||||
fp = fopen(name,"wb");
|
fp = fopen(name,"wb");
|
||||||
int x = 0;
|
|
||||||
if (!fp)
|
|
||||||
int x = 1;
|
|
||||||
if(fwrite(&head,1,16,fp)!=16)
|
if(fwrite(&head,1,16,fp)!=16)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
|
@ -62,24 +62,20 @@ int str_ltrim(char *str, int flags) {
|
||||||
unsigned int i=0; //mbg merge 7/17/06 changed to unsigned int
|
unsigned int i=0; //mbg merge 7/17/06 changed to unsigned int
|
||||||
|
|
||||||
while (str[0]) {
|
while (str[0]) {
|
||||||
if ((str[0] != ' ') || (str[0] != '\t') || (str[0] != '\r') || (str[0] != '\n')) break;
|
|
||||||
|
|
||||||
if ((flags & STRIP_SP) && (str[0] == ' ')) {
|
if ((flags & STRIP_SP) && (str[0] == ' ')) {
|
||||||
i++;
|
i++;
|
||||||
strcpy(str,str+1);
|
strcpy(str,str+1);
|
||||||
}
|
} else if ((flags & STRIP_TAB) && (str[0] == '\t')) {
|
||||||
if ((flags & STRIP_TAB) && (str[0] == '\t')) {
|
|
||||||
i++;
|
i++;
|
||||||
strcpy(str,str+1);
|
strcpy(str,str+1);
|
||||||
}
|
} else if ((flags & STRIP_CR) && (str[0] == '\r')) {
|
||||||
if ((flags & STRIP_CR) && (str[0] == '\r')) {
|
|
||||||
i++;
|
i++;
|
||||||
strcpy(str,str+1);
|
strcpy(str,str+1);
|
||||||
}
|
} else if ((flags & STRIP_LF) && (str[0] == '\n')) {
|
||||||
if ((flags & STRIP_LF) && (str[0] == '\n')) {
|
|
||||||
i++;
|
i++;
|
||||||
strcpy(str,str+1);
|
strcpy(str,str+1);
|
||||||
}
|
} else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -90,30 +86,23 @@ int str_ltrim(char *str, int flags) {
|
||||||
///Removes whitespace from right side of string, depending on the flags set (See STRIP_x definitions in xstring.h)
|
///Removes whitespace from right side of string, depending on the flags set (See STRIP_x definitions in xstring.h)
|
||||||
///Returns number of characters removed
|
///Returns number of characters removed
|
||||||
int str_rtrim(char *str, int flags) {
|
int str_rtrim(char *str, int flags) {
|
||||||
unsigned int i=0; //mbg merge 7/17/06 changed to unsigned int
|
unsigned int i=0, strl; //mbg merge 7/17/06 changed to unsigned int
|
||||||
|
|
||||||
while (strlen(str)) {
|
|
||||||
if ((str[strlen(str)-1] != ' ') ||
|
|
||||||
(str[strlen(str)-1] != '\t') ||
|
|
||||||
(str[strlen(str)-1] != '\r') ||
|
|
||||||
(str[strlen(str)-1] != '\n')) break;
|
|
||||||
|
|
||||||
|
while (strl = strlen(str)) {
|
||||||
if ((flags & STRIP_SP) && (str[0] == ' ')) {
|
if ((flags & STRIP_SP) && (str[0] == ' ')) {
|
||||||
i++;
|
i++;
|
||||||
str[strlen(str)-1] = 0;
|
str[str] = 0;
|
||||||
}
|
} else if ((flags & STRIP_TAB) && (str[0] == '\t')) {
|
||||||
if ((flags & STRIP_TAB) && (str[0] == '\t')) {
|
|
||||||
i++;
|
i++;
|
||||||
str[strlen(str)-1] = 0;
|
str[strl] = 0;
|
||||||
}
|
} else if ((flags & STRIP_CR) && (str[0] == '\r')) {
|
||||||
if ((flags & STRIP_CR) && (str[0] == '\r')) {
|
|
||||||
i++;
|
i++;
|
||||||
str[strlen(str)-1] = 0;
|
str[strl] = 0;
|
||||||
}
|
} else if ((flags & STRIP_LF) && (str[0] == '\n')) {
|
||||||
if ((flags & STRIP_LF) && (str[0] == '\n')) {
|
|
||||||
i++;
|
i++;
|
||||||
str[strlen(str)-1] = 0;
|
str[strl] = 0;
|
||||||
}
|
} else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -441,7 +430,7 @@ void splitpath(const char* path, char* drv, char* dir, char* name, char* ext)
|
||||||
*name = '\0';
|
*name = '\0';
|
||||||
} else
|
} else
|
||||||
for(s=p; s<end; )
|
for(s=p; s<end; )
|
||||||
*s++;
|
s++;
|
||||||
|
|
||||||
if (dir) {
|
if (dir) {
|
||||||
for(s=path; s<p; )
|
for(s=path; s<p; )
|
||||||
|
|
Loading…
Reference in New Issue