Exemple #1
0
//---------------------------------------------------------------------------------
bool isRumbleInserted(void) {
//---------------------------------------------------------------------------------
	uint16 four[4];
	sysSetCartOwner(BUS_OWNER_ARM9);
	// First, check for 0x96 to see if it's a GBA game
	if (GBA_HEADER.is96h == 0x96) {

		//if it is a game, we check the game code
		//to see if it is warioware twisted
		if (	(GBA_HEADER.gamecode[0] == 'R') &&
				(GBA_HEADER.gamecode[1] == 'Z') &&
				(GBA_HEADER.gamecode[2] == 'W') &&
				(GBA_HEADER.gamecode[3] == 'E')
			)
		{
			rumbleType = WARIOWARE;
			WARIOWARE_ENABLE = 8;
			return true;
		}
		return false;

	} else {

		rumbleType = RUMBLE;
		// Now check to see if it's true open bus, or if D1 is pulled low
		four[0] = GBA_BUS[0] & 0xFF;
		four[1] = GBA_BUS[1] & 0xFF;
		four[2] = GBA_BUS[2] & 0xFF;
		four[3] = GBA_BUS[3] & 0xFF;
		return (four[0] == 0x00) && (four[2] == 0x00) && (four[1] == 0x01) && (four[3] == 0x01);
	}
}
Exemple #2
0
int main(int argc, char* argv[])
{
    REG_POWERCNT = POWER_ALL & ~(POWER_MATRIX | POWER_3D_CORE); // don't need 3D
    consoleDebugInit(DebugDevice_CONSOLE);

    defaultExceptionHandler();

    time(&rawTime);
    lastRawTime = rawTime;
    timerStart(0, ClockDivider_1024, TIMER_FREQ_1024(1), clockUpdater);

    /* Reset the EZ3in1 if present */
    if (!__dsimode) {
        sysSetCartOwner(BUS_OWNER_ARM9);

        GBA_BUS[0x0000] = 0xF0;
        GBA_BUS[0x1000] = 0xF0;
    }

    fifoSetValue32Handler(FIFO_USER_02, fifoValue32Handler, NULL);

    sharedData = (SharedData*)memUncached(malloc(sizeof(SharedData)));
    sharedData->scalingOn = false;
    // It might make more sense to use "fifoSendAddress" here.
    // However there may have been something wrong with it in dsi mode.
    fifoSendValue32(FIFO_USER_03, ((u32)sharedData)&0x00ffffff);

    consoleOn = true;
    initConsole();
    initInput();
    readConfigFile();

    if (argc >= 2) {
        char* filename = argv[1];
        loadProgram(filename);
        initializeGameboyFirstTime();
    }
    else {
        selectRom();
    }
    consoleOn = false;
    updateScreens();

    runEmul();

    return 0;
}
Exemple #3
0
int checkRumble() {
    if (__dsimode)
        return 0;

    sysSetCartOwner(BUS_OWNER_ARM9);

    OpenNorWrite();
    uint32 rumbleID = ReadNorFlashID();
    CloseNorWrite();


    if (isRumbleInserted())
        return 1; //Warioware / Official rumble found.
    else if (rumbleID != 0)
        return 2; //3in1 found
    else
        return 0; //No rumble found
}
int RumbleCheck(void)
{
	sysSetCartOwner(BUS_OWNER_ARM9);

	if (isRumbleInserted()) {
		// Warioware / Official rumble
		rumbleType = 1;
	} else {
		// 3-in-1 found
		OpenNorWrite();
		uint32 rumbleID = ReadNorFlashID();
		CloseNorWrite();
		if (rumbleID != 0) rumbleType = 2; 
		else rumbleType = 0;
	}

	return rumbleType;
}
Exemple #5
0
const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void)
{
	// If running on an NDS, make sure the correct CPU can access
	// the GBA cart. First implemented by SaTa.
#ifdef NDS
 #ifdef ARM9
	sysSetCartOwner(BUS_OWNER_ARM9);
 #endif
#endif

	int i;

	for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
		if ((ioInterfaces[i]->features & FEATURE_SLOT_GBA) && (ioInterfaces[i]->fn_startup())) {
			return ioInterfaces[i];
		}
	}
	return NULL;
}