//--------------------------------------------------------------------------------- void irqSet(u32 mask, IntFn handler) { //--------------------------------------------------------------------------------- int oldIME = enterCriticalSection(); __irqSet(mask,handler,irqTable); if(mask & IRQ_VBLANK) REG_DISPSTAT |= DISP_VBLANK_IRQ ; if(mask & IRQ_HBLANK) REG_DISPSTAT |= DISP_HBLANK_IRQ ; if(mask & IRQ_IPC_SYNC) REG_IPC_SYNC |= IPC_SYNC_IRQ_ENABLE; leaveCriticalSection(oldIME); }
void patchit(int romSize2) { FILE *patchf = fopen(patchPath, "rb"); u8 header[0x50]; fread(header,1,0x50,patchf); if(memcmp(header,"flygbapatch",0xC)) { systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error in patchfile")); while(1); } int patchnum = *(u32*)&header[0x10]; for(int i = 0;i < patchnum;i++) { int type; fread((void*)&type,1,0x4,patchf); switch (type) { case 0: int offsetgba; int offsetthisfile; fread((void*)&offsetgba,1,0x4,patchf); fread((void*)&offsetthisfile,1,0x4,patchf); if(offsetgba + chucksize < romSize2) { int coo = ftell(patchf); fseek(patchf,offsetthisfile,SEEK_SET); fread(rom + offsetgba,1,chucksize,patchf); fseek(patchf,coo,SEEK_SET); } else { getandpatchmap(offsetgba,offsetthisfile); } break; case 1: fread((void*)&cheatsNumber,1,0x4,patchf); int offset; fread((void*)&offset,1,0x4,patchf); int coo = ftell(patchf); fseek(patchf,offset,SEEK_SET); fread((void*)cheatsList,1,cheatsNumber*28,patchf); fseek(patchf,coo,SEEK_SET); __irqSet(IRQ_FIFO_NOT_EMPTY,arm7dmareqandcheat,irqTable); break; } } }
//--------------------------------------------------------------------------------- void irqSetAUX(u32 mask, IntFn handler) { //--------------------------------------------------------------------------------- int oldIME = enterCriticalSection(); __irqSet(mask,handler,irqTableAUX); leaveCriticalSection(oldIME); }