Saves NVR on exit, fatal, and before any kind of menu or configuration change triggered reset, rather than every second. Should improve performance and reduce disk writes.

This commit is contained in:
OBattler
2016-07-11 06:48:06 +02:00
parent 289f3fe96a
commit c972a253ea
4 changed files with 5 additions and 2 deletions

View File

@@ -71,7 +71,6 @@ void nvr_onesec(void *p)
{ {
nvr_update_status = RTCUIP; nvr_update_status = RTCUIP;
if (!enable_sync) rtc_tick(); if (!enable_sync) rtc_tick();
nvr_dosave = 1;
} }
} }
else if (nvr_onesec_cnt == 73) /* 73 of our cycles means 244+1984 us = update in progress time per the specification. */ else if (nvr_onesec_cnt == 73) /* 73 of our cycles means 244+1984 us = update in progress time per the specification. */

View File

@@ -91,6 +91,7 @@ void fatal(const char *format, ...)
vprintf(format, ap); vprintf(format, ap);
va_end(ap); va_end(ap);
fflush(stdout); fflush(stdout);
savenvr();
dumppic(); dumppic();
dumpregs(); dumpregs();
fflush(stdout); fflush(stdout);

View File

@@ -85,7 +85,6 @@ static void rtc_recalc()
internal_clock.mon = 1; internal_clock.mon = 1;
internal_clock.year++; internal_clock.year++;
} }
nvr_dosave = 1;
} }
/* Called when ticking the second */ /* Called when ticking the second */

View File

@@ -792,6 +792,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
TerminateThread(mainthreadh,0); TerminateThread(mainthreadh,0);
// pclog("Quited? %i\n",quited); // pclog("Quited? %i\n",quited);
// pclog("Closepc\n"); // pclog("Closepc\n");
savenvr();
if (save_window_pos && window_remember) if (save_window_pos && window_remember)
saveconfig(); saveconfig();
closepc(); closepc();
@@ -957,6 +958,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_FILE_RESET: case IDM_FILE_RESET:
pause=1; pause=1;
Sleep(100); Sleep(100);
savenvr();
resetpc(); resetpc();
pause=0; pause=0;
break; break;
@@ -964,12 +966,14 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_FILE_HRESET: case IDM_FILE_HRESET:
pause=1; pause=1;
Sleep(100); Sleep(100);
savenvr();
resetpchard(); resetpchard();
pause=0; pause=0;
break; break;
case IDM_FILE_RESET_CAD: case IDM_FILE_RESET_CAD:
pause=1; pause=1;
Sleep(100); Sleep(100);
savenvr();
resetpc_cad(); resetpc_cad();
pause=0; pause=0;
break; break;