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 2: print_Msg(F("128KB")); break;
|
||||||
case 3: print_Msg(F("256KB")); break;
|
case 3: print_Msg(F("256KB")); break;
|
||||||
case 4: print_Msg(F("512KB")); break;
|
case 4: print_Msg(F("512KB")); break;
|
||||||
case 5:
|
case 5: print_Msg(F("1MB")); break;
|
||||||
if (romType == 1 || romType == 2 || romType == 3) {
|
case 6: print_Msg(F("2MB")); break;
|
||||||
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 7: print_Msg(F("4MB")); break;
|
case 7: print_Msg(F("4MB")); break;
|
||||||
case 82: print_Msg(F("1.1MB")); break;
|
case 82: print_Msg(F("1.1MB")); break;
|
||||||
case 83: print_Msg(F("1.2MB")); break;
|
case 83: print_Msg(F("1.2MB")); break;
|
||||||
@ -354,17 +340,19 @@ void getCartInfo_GB() {
|
|||||||
if (romType == 6) {
|
if (romType == 6) {
|
||||||
sramBanks = 1;
|
sramBanks = 1;
|
||||||
}
|
}
|
||||||
if (sramSize == 2) {
|
switch (sramSize) {
|
||||||
sramBanks = 1;
|
case 2:
|
||||||
}
|
sramBanks = 1;
|
||||||
if (sramSize == 3) {
|
break;
|
||||||
sramBanks = 4;
|
case 3:
|
||||||
}
|
sramBanks = 4;
|
||||||
if (sramSize == 4) {
|
break;
|
||||||
sramBanks = 16;
|
case 4:
|
||||||
}
|
sramBanks = 16;
|
||||||
if (sramSize == 5) {
|
break;
|
||||||
sramBanks = 8;
|
case 5:
|
||||||
|
sramBanks = 8;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RAM end address
|
// RAM end address
|
||||||
|
@ -57,54 +57,44 @@ static const char pceCartMenuItem1[] PROGMEM = "Read Rom";
|
|||||||
static const char pceCartMenuItem2[] PROGMEM = "Reset";
|
static const char pceCartMenuItem2[] PROGMEM = "Reset";
|
||||||
static const char* const menuOptionspceCart[] PROGMEM = {pceCartMenuItem1, pceCartMenuItem2};
|
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;
|
uint8_t current, i;
|
||||||
static uint8_t previousstatus;
|
static uint8_t previous;
|
||||||
|
uint8_t steps = 20;
|
||||||
|
|
||||||
//Find progressbar length and draw if processed size is not 0
|
//Find progressbar length and draw if processed size is not 0
|
||||||
if (processedsize != 0)
|
if (processed == 0)
|
||||||
{
|
{
|
||||||
|
previous = 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;
|
|
||||||
print_Msg(F("["));
|
print_Msg(F("["));
|
||||||
display_Update();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user