Merge pull request #31 from arasabbasi/master

Minor changes, not tested
This commit is contained in:
sanni 2019-02-09 00:01:50 +01:00 committed by GitHub
commit a6efb62513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 69 deletions

View File

@ -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) {
sramBanks = 1;
}
if (sramSize == 3) {
sramBanks = 4;
}
if (sramSize == 4) {
sramBanks = 16;
}
if (sramSize == 5) {
sramBanks = 8;
switch (sramSize) {
case 2:
sramBanks = 1;
break;
case 3:
sramBanks = 4;
break;
case 4:
sramBanks = 16;
break;
case 5:
sramBanks = 8;
break;
}
// RAM end address

View File

@ -57,54 +57,44 @@ 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)
{
// 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);
}
//Draw "*" if needed
if (currentstatus > previousstatus)
{
for (i = previousstatus; i < currentstatus; i++)
{
if (i == 19)
{
//If end of progress bar, finish progress bar by drawing "]"
print_Msg(F("]"));
}
else
{
print_Msg(F("*"));
}
//Update display
display_Update();
}
//update previous "*" status
previousstatus = currentstatus;
}
}
else
{
//If processed size is 0, initialize and draw "["
previousstatus = 0;
previous = 0;
print_Msg(F("["));
display_Update();
return;
}
// Progress bar
current = (processed >= total) ? steps : processed / (total / steps) ;
//Draw "*" if needed
if (current > previous)
{
for (i = previous; i < current; i++)
{
// steps are 20, so 20 - 1 = 19.
if (i == (19))
{
//If end of progress bar, finish progress bar by drawing "]"
print_Msg(F("]"));
}
else
{
print_Msg(F("*"));
}
}
//update previous "*" status
previous = current;
//Update display
display_Update();
}
}