diff --git a/gb.h b/gb.h index 2bd3525..b131e51 100644 --- a/gb.h +++ b/gb.h @@ -25,5 +25,7 @@ extern unsigned long gb_divbase; extern unsigned long gb_timbase; extern uint8_t gb_timshift; +#define BENCHMARK 0 + extern unsigned benchmark_sound, benchmark_gfx; extern int sound_enabled; \ No newline at end of file diff --git a/misc.cpp b/misc.cpp index 030c397..9107e91 100644 --- a/misc.cpp +++ b/misc.cpp @@ -47,7 +47,10 @@ void load_game(char *name) return; } - fread(cart.data, 1, size, f); + int readed = fread(cart.data, 1, size, f); + if (readed != size) { + __log ("Did not read as many bytes as specified!"); + } fclose(f); } @@ -110,7 +113,10 @@ void load_SRAM(uint8_t* ram_ptr, long size) return; } - fread(ram_ptr, 1, size, f); + int readed = fread(ram_ptr, 1, size, f); + if (readed != size) { + __log ("Did not read as many bytes as specified!"); + } fclose(f); } diff --git a/ppu.cpp b/ppu.cpp index 7ee9c83..f2c43a2 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -235,7 +235,6 @@ void ppu_vsync() { TimerInit(); Timer(); - //fps_time = oldtime = GetTickCount(); first = 0; } @@ -267,13 +266,13 @@ void ppu_vsync() bm_g/=8; bm_s/=8; bm_o=time-bm_s-bm_g; - //if(time) - // sprintf(title, "GameBoy-%15s [%u fps]O:%02dG:%02dS:%02d", cart.title, - // 1000000/time,(bm_o*100)/time,(bm_g*100)/time,(bm_s*100)/time); - //else +#if BENCHMARK + if(time) + sprintf(title, "GameBoy - %15s [%u fps]O:%02dG:%02dS:%02d", cart.title, + 1000000/time,(bm_o*100)/time,(bm_g*100)/time,(bm_s*100)/time); + else +#endif sprintf(title, "GameBoy - %s [%u fps]", cart.title, 1000000/time); sdl_win_update_title(title); } - - //oldtime = GetTickCount(); }