From b98baef23961d5c2c91f0e341c638e454d23850b Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Wed, 20 May 2009 19:51:28 +0000 Subject: [PATCH] *Small change in install again. --- source/libwbfs/libwbfs.c | 16 ++++++++++++++-- source/menu.cpp | 13 ------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/source/libwbfs/libwbfs.c b/source/libwbfs/libwbfs.c index 450c759a..b891c3b5 100644 --- a/source/libwbfs/libwbfs.c +++ b/source/libwbfs/libwbfs.c @@ -4,6 +4,7 @@ #include "libwbfs.h" +#include #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) @@ -405,6 +406,8 @@ u32 wbfs_add_disc(wbfs_t*p,read_wiidisc_callback_t read_src_wii_disc, wbfs_disc_info_t *info = 0; u8* copy_buffer = 0; used = wbfs_malloc(p->n_wii_sec_per_disc); + time_t last_time = 0; + time_t time_now = 0; if(!used) ERROR("unable to alloc memory"); if(!copy_1_1) @@ -461,8 +464,17 @@ u32 wbfs_add_disc(wbfs_t*p,read_wiidisc_callback_t read_src_wii_disc, p->write_hdsector(p->callback_data,p->part_lba+bl*(p->wbfs_sec_sz/p->hd_sec_sz)+j*(p->wii_sec_sz/p->hd_sec_sz), p->wii_sec_sz/p->hd_sec_sz,copy_buffer); cur++; - if(spinner) - spinner(cur,tot); + } + if(spinner) { + if(last_time == 0) + time(&last_time); + + time(&time_now); + /* Update that crap only every 0.5 secs */ + if (difftime(time_now,last_time) > 0.5) { + spinner(cur,tot); + last_time = 0; + } } } info->wlba_table[i] = wbfs_htons(bl); diff --git a/source/menu.cpp b/source/menu.cpp index 48f9768f..04095a7a 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1705,8 +1705,6 @@ ShowProgress (s32 done, s32 total) static u32 expected; u32 d, h, m, s; - static time_t last_time; - time_t time_now = 0; //first time if (!done) { @@ -1731,14 +1729,6 @@ ShowProgress (s32 done, s32 total) m = (d / 60) % 60; s = d % 60; - if(last_time == 0) - time(&last_time); - - time(&time_now); - - /** Update that crap only every 0.5 secs **/ - if (difftime(time_now,last_time) > 0.5) { - //Calculate percentage/size f32 percent = (done * 100.0) / total; @@ -1757,9 +1747,6 @@ ShowProgress (s32 done, s32 total) progressbarImg.SetTile((int)(80*done/total));} else {progressbarImg.SetTile((int)(100*done/total));} - last_time = 0; - } - } /****************************************************************************