- add save firmware settings (User, WiFi, WiFi AP);

- fix OpenGL shader for texture blending on decal mode;
This commit is contained in:
mtabachenko 2010-09-25 14:30:23 +00:00
parent 042e584b20
commit 436358a51b
6 changed files with 78 additions and 10 deletions

View File

@ -846,6 +846,7 @@ void MMU_Init(void) {
mc_init(&MMU.fw, MC_TYPE_FLASH); /* init fw device */
mc_alloc(&MMU.fw, NDS_FW_SIZE_V1);
MMU.fw.fp = NULL;
MMU.fw.isFirmware = true;
// Init Backup Memory device, this should really be done when the rom is loaded
//mc_init(&MMU.bupmem, MC_TYPE_AUTODETECT);

View File

@ -269,15 +269,15 @@ static INLINE void setIF(int PROCNUM, u32 flag)
extern void NDS_Reschedule();
NDS_Reschedule();
//TODO SEP - was this necessary???
//TODO SEP - was this necessary??? - CrazyMax 2010/09/25: needs for boot firmware
//generate the interrupt if enabled
//if ((MMU.reg_IE[PROCNUM] & (flag)) && MMU.reg_IME[PROCNUM])
//{
// if(PROCNUM==0)
// NDS_ARM9.waitIRQ = FALSE;
// else
// NDS_ARM7.waitIRQ = FALSE;
//}
if ((MMU.reg_IE[PROCNUM] & (flag)) && MMU.reg_IME[PROCNUM])
{
if(PROCNUM==0)
NDS_ARM9.waitIRQ = FALSE;
else
NDS_ARM7.waitIRQ = FALSE;
}
}
static INLINE void NDS_makeARM9Int(u32 num)

View File

@ -19,6 +19,7 @@
#include "firmware.h"
#include "NDSSystem.h"
#include "path.h"
#define DWNUM(i) ((i) >> 2)
@ -565,6 +566,41 @@ bool CFIRMWARE::load()
INFO(" * ARM7 unpacked size: 0x%08X (%i) bytes\n", size7, size7);
}
PathInfo path;
path.init(CommonSettings.Firmware);
path.getpathnoext(path.FIRMWARE, &MMU.fw.userfile[0]);
strcat(MMU.fw.userfile, ".dfc"); // DeSmuME Firmware Config
fp = fopen(MMU.fw.userfile, "rb");
if (fp)
{
char buf[0x300];
memset(buf, 0, 0x300);
if (fread(buf, 1, 0x100, fp) == 0x100)
{
printf("- loaded from %s:\n", MMU.fw.userfile);
memcpy(&data[0x3FE00], &buf[0], 0x100);
memcpy(&data[0x3FF00], &buf[0], 0x100);
printf(" * User settings\n");
memset(buf, 0, 0x100);
if (fread(buf, 1, 0x1D6, fp) == 0x1D6)
{
memcpy(&data[0x002A], &buf[0], 0x1D6);
printf(" * WiFi settings\n");
memset(buf, 0, 0x1D6);
if (fread(buf, 1, 0x300, fp) == 0x300)
{
memcpy(&data[0x3FA00], &buf[0], 0x300);
printf(" * WiFi AP settings\n");
}
}
}
fclose(fp);
}
printf("\n");
// TODO: add 512Kb support
memcpy(MMU.fw.data, data, 256*1024);
MMU.fw.fp = NULL;

View File

@ -191,6 +191,27 @@ void fw_reset_com(memory_chip_t *mc)
fwrite(mc->data, mc->size, 1, mc->fp);
}
if (mc->isFirmware&&CommonSettings.UseExtFirmware)
{
// copy User Settings 1 to User Settings 0 area
memcpy(&mc->data[0x3FE00], &mc->data[0x3FF00], 0x100);
printf("Firmware: save config");
FILE *fp = fopen(mc->userfile, "wb");
if (fp)
{
if (fwrite(&mc->data[0x3FF00], 1, 0x100, fp) == 0x100) // User Settings
if (fwrite(&mc->data[0x0002A], 1, 0x1D6, fp) == 0x1D6) // WiFi Settings
if (fwrite(&mc->data[0x3FA00], 1, 0x300, fp) == 0x300) // WiFi AP Settings
printf(" - done\n");
else
printf(" - failed\n");
fclose(fp);
}
else
printf(" - failed\n");
}
mc->write_enable = FALSE;
}

View File

@ -67,6 +67,10 @@ struct memory_chip_t
FILE *fp;
u8 autodetectbuf[32768];
int autodetectsize;
// needs only for firmware
bool isFirmware;
char userfile[260];
};
//the new backup system by zeromus

View File

@ -35,8 +35,14 @@ const char *fragmentShader = {"\
else \n\
if(texBlending == 1) \n\
{ \n\
flagColor.rgb = gl_Color.rgb * (1.0-texColor.a) + texColor.rgb * texColor.a;\n\
flagColor.a = texColor.a;\n\
if (texColor.a == 0.0 || hasTexture == 0) \n\
flagColor.rgb = gl_Color.rgb;\n\
else \n\
if (texColor.a == 1.0) \n\
flagColor.rgb = texColor.rgb;\n\
else \n\
flagColor.rgb = texColor.rgb * (1.0-texColor.a) + gl_Color.rgb * texColor.a;\n\
flagColor.a = gl_Color.a; \n\
} \n\
else \n\
if(texBlending == 2) \n\