mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-24 05:29:17 +01:00
Merge pull request #31 from arasabbasi/master
Minor changes, not tested
This commit is contained in:
commit
a6efb62513
@ -220,22 +220,8 @@ void setup_GB() {
|
||||
case 2: print_Msg(F("128KB")); break;
|
||||
case 3: print_Msg(F("256KB")); break;
|
||||
case 4: print_Msg(F("512KB")); break;
|
||||
case 5:
|
||||
if (romType == 1 || romType == 2 || romType == 3) {
|
||||
print_Msg(F("1MB"));
|
||||
}
|
||||
else {
|
||||
print_Msg(F("1MB"));
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (romType == 1 || romType == 2 || romType == 3) {
|
||||
print_Msg(F("2MB"));
|
||||
}
|
||||
else {
|
||||
print_Msg(F("2MB"));
|
||||
}
|
||||
break;
|
||||
case 5: print_Msg(F("1MB")); break;
|
||||
case 6: print_Msg(F("2MB")); break;
|
||||
case 7: print_Msg(F("4MB")); break;
|
||||
case 82: print_Msg(F("1.1MB")); break;
|
||||
case 83: print_Msg(F("1.2MB")); break;
|
||||
@ -354,17 +340,19 @@ void getCartInfo_GB() {
|
||||
if (romType == 6) {
|
||||
sramBanks = 1;
|
||||
}
|
||||
if (sramSize == 2) {
|
||||
switch (sramSize) {
|
||||
case 2:
|
||||
sramBanks = 1;
|
||||
}
|
||||
if (sramSize == 3) {
|
||||
break;
|
||||
case 3:
|
||||
sramBanks = 4;
|
||||
}
|
||||
if (sramSize == 4) {
|
||||
break;
|
||||
case 4:
|
||||
sramBanks = 16;
|
||||
}
|
||||
if (sramSize == 5) {
|
||||
break;
|
||||
case 5:
|
||||
sramBanks = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
// RAM end address
|
||||
|
@ -57,33 +57,31 @@ static const char pceCartMenuItem1[] PROGMEM = "Read Rom";
|
||||
static const char pceCartMenuItem2[] PROGMEM = "Reset";
|
||||
static const char* const menuOptionspceCart[] PROGMEM = {pceCartMenuItem1, pceCartMenuItem2};
|
||||
|
||||
void draw_progressbar(uint32_t processedsize, uint32_t totalsize)
|
||||
void draw_progressbar(uint32_t processed, uint32_t total)
|
||||
{
|
||||
uint8_t currentstatus, i;
|
||||
static uint8_t previousstatus;
|
||||
uint8_t current, i;
|
||||
static uint8_t previous;
|
||||
uint8_t steps = 20;
|
||||
|
||||
//Find progressbar length and draw if processed size is not 0
|
||||
if (processedsize != 0)
|
||||
if (processed == 0)
|
||||
{
|
||||
previous = 0;
|
||||
print_Msg(F("["));
|
||||
display_Update();
|
||||
return;
|
||||
}
|
||||
|
||||
// Progress bar
|
||||
if (processedsize >= totalsize)
|
||||
{
|
||||
//if processed size is equal to total process size, finish drawing progress bar
|
||||
currentstatus = 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if processed size did not reach total process size, find how many "*" should be drawn
|
||||
currentstatus = processedsize / (totalsize / 20);
|
||||
}
|
||||
current = (processed >= total) ? steps : processed / (total / steps) ;
|
||||
|
||||
//Draw "*" if needed
|
||||
if (currentstatus > previousstatus)
|
||||
if (current > previous)
|
||||
{
|
||||
for (i = previousstatus; i < currentstatus; i++)
|
||||
for (i = previous; i < current; i++)
|
||||
{
|
||||
if (i == 19)
|
||||
// steps are 20, so 20 - 1 = 19.
|
||||
if (i == (19))
|
||||
{
|
||||
//If end of progress bar, finish progress bar by drawing "]"
|
||||
print_Msg(F("]"));
|
||||
@ -92,18 +90,10 @@ void draw_progressbar(uint32_t processedsize, uint32_t totalsize)
|
||||
{
|
||||
print_Msg(F("*"));
|
||||
}
|
||||
//Update display
|
||||
display_Update();
|
||||
}
|
||||
//update previous "*" status
|
||||
previousstatus = currentstatus;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If processed size is 0, initialize and draw "["
|
||||
previousstatus = 0;
|
||||
print_Msg(F("["));
|
||||
previous = current;
|
||||
//Update display
|
||||
display_Update();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user