-gtk code now working again.

This commit is contained in:
cyberwarriorx 2006-10-15 23:00:26 +00:00
parent 2ba05970a8
commit ea3822a654
3 changed files with 4 additions and 115 deletions

View File

@ -22,120 +22,14 @@ u32 desmume_last_cycle;
void desmume_init()
{
NDSInit();
NDS_Init();
execute = FALSE;
}
void desmume_free()
{
execute = FALSE;
desmume_free_rom();
NDSDeInit();
}
void desmume_mem_init()
{
//ARM7 EXCEPTION VECTORS
MMU_writeWord(1, 0x00, 0xE25EF002);
MMU_writeWord(1, 0x04, 0xEAFFFFFE);
MMU_writeWord(1, 0x18, 0xEA000000);
MMU_writeWord(1, 0x20, 0xE92D500F);
MMU_writeWord(1, 0x24, 0xE3A00301);
MMU_writeWord(1, 0x28, 0xE28FE000);
MMU_writeWord(1, 0x2C, 0xE510F004);
MMU_writeWord(1, 0x30, 0xE8BD500F);
MMU_writeWord(1, 0x34, 0xE25EF004);
//ARM9 EXCEPTION VECTORS
MMU_writeWord(0, 0xFFF0018, 0xEA000000);
MMU_writeWord(0, 0xFFF0020, 0xE92D500F);
MMU_writeWord(0, 0xFFF0024, 0xEE190F11);
MMU_writeWord(0, 0xFFF0028, 0xE1A00620);
MMU_writeWord(0, 0xFFF002C, 0xE1A00600);
MMU_writeWord(0, 0xFFF0030, 0xE2800C40);
MMU_writeWord(0, 0xFFF0034, 0xE28FE000);
MMU_writeWord(0, 0xFFF0038, 0xE510F004);
MMU_writeWord(0, 0xFFF003C, 0xE8BD500F);
MMU_writeWord(0, 0xFFF0040, 0xE25EF004);
}
#define DSGBA_EXTENSTION ".ds.gba"
#define DSGBA_LOADER_SIZE 512
enum
{
ROM_NDS = 0,
ROM_DSGBA
};
int desmume_load_rom(const char *filename)
{
int i;
uint type;
const char *p = filename;
FILE *file;
u32 size, mask;
u8 *data;
type = ROM_NDS;
p += strlen(p);
p -= strlen(DSGBA_EXTENSTION);
if(memcmp(p, DSGBA_EXTENSTION, strlen(DSGBA_EXTENSTION)) == 0)
{
type = ROM_DSGBA;
}
file = fopen(filename, "rb");
if(!file) { return -1; }
fseek(file, 0, SEEK_END);
size = ftell(file);
fseek(file, 0, SEEK_SET);
if(type == ROM_DSGBA)
{
fseek(file, DSGBA_LOADER_SIZE, SEEK_SET);
size -= DSGBA_LOADER_SIZE;
}
mask = size;
mask |= (mask >>1);
mask |= (mask >>2);
mask |= (mask >>4);
mask |= (mask >>8);
mask |= (mask >>16);
data = (u8*)malloc(mask + 1);
if(!data) { fclose(file); return -1; }
i = fread(data, 1, size, file);
fclose(file);
MMU_unsetRom();
NDS_loadROM(data, mask);
desmume_rom_data = data;
strcpy(szRomPath, dirname((char *) filename));
cflash_close();
cflash_init();
return i;
}
void desmume_free_rom()
{
if(desmume_rom_data)
{
free(desmume_rom_data);
desmume_rom_data = NULL;
}
}
void desmume_reset()
{
execute = FALSE;
desmume_mem_init();
desmume_last_cycle = 0;
NDS_DeInit();
}
void desmume_pause()

View File

@ -25,10 +25,6 @@
extern void desmume_init();
extern void desmume_free();
extern int desmume_load_rom(const char *filename);
extern void desmume_free_rom();
extern void desmume_reset();
extern void desmume_pause();
extern void desmume_resume();
extern void desmume_toggle();

View File

@ -188,8 +188,7 @@ Build date: " __DATE__ ", " __TIME__ ".");
static int Open(const char *filename)
{
int i = desmume_load_rom(filename);
desmume_reset();
int i = NDS_LoadROM(filename);
return i;
}
@ -292,7 +291,7 @@ static void Close()
static void Reset()
{
desmume_reset();
NDS_Reset();
desmume_resume();
pStatusBar_Change("Running ...");