fix gb screen adjustment saving, menu tweak, minor optimizations from dancinninja

This commit is contained in:
dborth 2010-01-06 18:22:12 +00:00
parent 5088bac94b
commit e5c58eab80
6 changed files with 29 additions and 34 deletions

View File

@ -172,12 +172,10 @@ void SoundWii::write(u16 * finalWave, int length)
u32 *dst = (u32 *)mixerdata; u32 *dst = (u32 *)mixerdata;
u32 intlen = (3200 >> 2); u32 intlen = (3200 >> 2);
u32 fixofs = 0; u32 fixofs = 0;
u32 fixinc; u32 fixinc = 60211; // length = 2940 - GB
if (gameType == 2) // length = 1468 - GBA if (gameType == 2) // length = 1468 - GBA
fixinc = 30065; fixinc = 30065;
else // length = 2940 - GB
fixinc = 60211;
do do
{ {

View File

@ -846,27 +846,17 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
continue; continue;
} }
printf("datasize: %d\n", datasize);
while(written < datasize) while(written < datasize)
{ {
if(datasize - written > 4096) nextwrite=4096; if(datasize - written > 4096) nextwrite=4096;
else nextwrite = datasize-written; else nextwrite = datasize-written;
writesize = fwrite (buffer+written, 1, nextwrite, file); writesize = fwrite (buffer+written, 1, nextwrite, file);
if(writesize != nextwrite) if(writesize != nextwrite) break; // write failure
{
printf("writesize (%d) != nextwrite (%d)!\n", writesize, nextwrite);
break; // write failure
}
written += writesize; written += writesize;
} }
fclose (file); fclose (file);
if(written != datasize) if(written != datasize) written = 0;
{
printf("wrote 0!\n");
written = 0;
}
if(!written) if(!written)
{ {

View File

@ -2794,7 +2794,7 @@ static int MenuSettingsVideo()
GuiOptionBrowser optionBrowser(552, 248, &options); GuiOptionBrowser optionBrowser(552, 248, &options);
optionBrowser.SetPosition(0, 108); optionBrowser.SetPosition(0, 108);
optionBrowser.SetCol2Position(200); optionBrowser.SetCol2Position(240);
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
HaltGui(); HaltGui();

View File

@ -480,8 +480,8 @@ decodePrefsData ()
loadXMLSetting(&GCSettings.videomode, "videomode"); loadXMLSetting(&GCSettings.videomode, "videomode");
loadXMLSetting(&GCSettings.gbaZoomHor, "gbaZoomHor"); loadXMLSetting(&GCSettings.gbaZoomHor, "gbaZoomHor");
loadXMLSetting(&GCSettings.gbaZoomVert, "gbaZoomVert"); loadXMLSetting(&GCSettings.gbaZoomVert, "gbaZoomVert");
loadXMLSetting(&GCSettings.gbZoomHor, "gbaZoomHor"); loadXMLSetting(&GCSettings.gbZoomHor, "gbZoomHor");
loadXMLSetting(&GCSettings.gbZoomVert, "gbaZoomVert"); loadXMLSetting(&GCSettings.gbZoomVert, "gbZoomVert");
loadXMLSetting(&GCSettings.render, "render"); loadXMLSetting(&GCSettings.render, "render");
loadXMLSetting(&GCSettings.scaling, "scaling"); loadXMLSetting(&GCSettings.scaling, "scaling");
loadXMLSetting(&GCSettings.xshift, "xshift"); loadXMLSetting(&GCSettings.xshift, "xshift");

View File

@ -9,10 +9,11 @@ int eepromMode = EEPROM_IDLE;
int eepromByte = 0; int eepromByte = 0;
int eepromBits = 0; int eepromBits = 0;
int eepromAddress = 0; int eepromAddress = 0;
//--DCN (restructuring for alignment)
int eepromSize = 512;
u8 eepromData[0x2000]; u8 eepromData[0x2000];
u8 eepromBuffer[16]; u8 eepromBuffer[16];
bool eepromInUse = false; bool eepromInUse = false;
int eepromSize = 512;
variable_desc eepromSaveData[] = { variable_desc eepromSaveData[] = {
{ &eepromMode, sizeof(int) }, { &eepromMode, sizeof(int) },
@ -78,7 +79,7 @@ int eepromRead(u32 /* address */)
return 1; return 1;
case EEPROM_READDATA: case EEPROM_READDATA:
{ {
eepromBits++; ++eepromBits;
if(eepromBits == 4) { if(eepromBits == 4) {
eepromMode = EEPROM_READDATA2; eepromMode = EEPROM_READDATA2;
eepromBits = 0; eepromBits = 0;
@ -88,13 +89,14 @@ int eepromRead(u32 /* address */)
} }
case EEPROM_READDATA2: case EEPROM_READDATA2:
{ {
int data = 0; //--DCN
int address = eepromAddress << 3; int address = eepromAddress << 3;
int mask = 1 << (7 - (eepromBits & 7)); int mask = 1 << (7 - (eepromBits & 7));
data = (eepromData[address+eepromByte] & mask) ? 1 : 0; int data = (eepromData[address+eepromByte] & mask) ? 1 : 0;
eepromBits++;
++eepromBits;
if((eepromBits & 7) == 0) if((eepromBits & 7) == 0)
eepromByte++; ++eepromByte;
if(eepromBits == 0x40) if(eepromBits == 0x40)
eepromMode = EEPROM_IDLE; eepromMode = EEPROM_IDLE;
return data; return data;
@ -120,9 +122,9 @@ void eepromWrite(u32 /* address */, u8 value)
case EEPROM_READADDRESS: case EEPROM_READADDRESS:
eepromBuffer[eepromByte] <<= 1; eepromBuffer[eepromByte] <<= 1;
eepromBuffer[eepromByte] |= bit; eepromBuffer[eepromByte] |= bit;
eepromBits++; ++eepromBits;
if((eepromBits & 7) == 0) { if((eepromBits & 7) == 0) {
eepromByte++; ++eepromByte;
} }
if(cpuDmaCount == 0x11 || cpuDmaCount == 0x51) { if(cpuDmaCount == 0x11 || cpuDmaCount == 0x51) {
if(eepromBits == 0x11) { if(eepromBits == 0x11) {
@ -141,8 +143,8 @@ void eepromWrite(u32 /* address */, u8 value)
eepromBits = 0; eepromBits = 0;
} }
} }
} else { //--DCN (else, if into else if, may be an improvement; couldn't hurt)
if(eepromBits == 9) { } else if(eepromBits == 9) {
eepromInUse = true; eepromInUse = true;
eepromAddress = (eepromBuffer[0] & 0x3F); eepromAddress = (eepromBuffer[0] & 0x3F);
if(!(eepromBuffer[0] & 0x40)) { if(!(eepromBuffer[0] & 0x40)) {
@ -156,7 +158,6 @@ void eepromWrite(u32 /* address */, u8 value)
eepromBits = 0; eepromBits = 0;
} }
} }
}
break; break;
case EEPROM_READDATA: case EEPROM_READDATA:
case EEPROM_READDATA2: case EEPROM_READDATA2:
@ -166,15 +167,21 @@ void eepromWrite(u32 /* address */, u8 value)
case EEPROM_WRITEDATA: case EEPROM_WRITEDATA:
eepromBuffer[eepromByte] <<= 1; eepromBuffer[eepromByte] <<= 1;
eepromBuffer[eepromByte] |= bit; eepromBuffer[eepromByte] |= bit;
eepromBits++; ++eepromBits;
if((eepromBits & 7) == 0) { if((eepromBits & 7) == 0) {
eepromByte++; ++eepromByte;
} }
if(eepromBits == 0x40) { if(eepromBits == 0x40) {
eepromInUse = true; eepromInUse = true;
// write data; // write data;
for(int i = 0; i < 8; i++) { //--DCN
eepromData[(eepromAddress << 3) + i] = eepromBuffer[i]; int eeprom3 = eepromAddress << 3;
for(int i = 0; i < 8; i+=4) {
eepromData[eeprom3 + i+1] = eepromBuffer[i+1];
eepromData[eeprom3 + i+2] = eepromBuffer[i+2];
eepromData[eeprom3 + i+3] = eepromBuffer[i+3];
eepromData[eeprom3 + i+4] = eepromBuffer[i+4];
} }
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
} else if(eepromBits == 0x41) { } else if(eepromBits == 0x41) {