Beispiel #1
0
void doSelect(struct FileSystem *fs, s16 choice) {
	const struct FileEntry *const file = dirList[choice];
	const char *str = file->fileName;
	u32 cluster = file->firstCluster;
	u32 length = file->length;
	const u32 clusterLen = fatGetClusterLength(fs);
	const u16 clustersPerStar = (u16)(length / (32*clusterLen));
	u16 x = 0, i;
	volatile u8 *const ssf2Reg = (volatile u8 *)0xA130F3;
	u8 page = 0x40;
	u8 *const LWM = (u8*)0x480000;
	u8 *const HWM = LWM + 512*1024;
	u8 *ptr = LWM;
	u8 isFirst;

	// Work out what x offset to use for the ROM name
	while ( *str ) {
		str++;
		x++;
	}
	x = (40-x) >> 1;
	str = dirList[choice]->fileName;

	// Construct loading screen
	VDP_waitVSync();
	VDP_clearPlan(VDP_PLAN_A, 1);
	VDP_waitDMACompletion();
	VDP_setTextPalette(PAL1);
	VDP_drawText(str, x, 11);
	VDP_setTextPalette(PAL2);
	VDP_drawText("Loading...", 15, 24);
	VDP_drawText("+--------------------------------+", 3, 25);
	VDP_drawText("|                                |", 3, 26);
	VDP_drawText("+--------------------------------+", 3, 27);
	VDP_setTextPalette(PAL0);
	*ssf2Reg = page;
	isFirst = 1;
	*((u16*)0x430000) = (clusterLen>>2)-1;
	for ( x = 4; x < 32+4; x++ ) {
		for ( i = 0; i < clustersPerStar; i++ ) {
			if ( isFirst ) {
				cluster = fatReadCluster(fs, cluster, (u8*)0x430002);
				isFirst = 0;
			} else {
				cluster = fatReadCluster(fs, cluster, ptr);
			}
			ptr += clusterLen;
			if ( ptr == HWM ) {
				ptr = LWM;
				page++;
				*ssf2Reg = page;
			}
		}
		VDP_drawText("*", x, 26);
	}
	*ssf2Reg = 0x40; // point back at bottom of RAM
	__asm__("trap #0");
}
Beispiel #2
0
Datei: main.c Projekt: clbr/SGDK
static void refreshDriverParams()
{
    const u16 driver_ind = getCurrentDriverIndex();
    const char* str;
    u16 start;
    u16 len;
    u16 posY;
    u16 i, j;

    VDP_clearTileMapRect(PLAN_A, 0, 3, 40, 8);

    str = driver->name;
    len = strlen(str);
    start = 20 - (len / 2);

    setTextPalette(driver != &drivers[0]);
    VDP_drawText("<", start - 2, 3);
    VDP_setTextPalette(PAL0);
    VDP_drawText(str, start, 3);
    setTextPalette(driver != &drivers[NUM_DRIVER - 1]);
    VDP_drawText(">", start + len + 1, 3);

    posY = 5;

    for(i = 0; i < driver->num_cmd; i++)
    {
        const cmd_def *cur_cmd = &driver->cmds[i];
        u16 posX = 2;

        str = cur_cmd->name;
        VDP_setTextPalette(PAL0);
        VDP_drawText(str, posX, posY);
        posX += strlen(str);

        for(j = 0; j < cur_cmd->num_param; j++)
        {
            const param_def *cur_param = &cur_cmd->params[j];

            str = cur_param->name;
            setTextPalette(params_value[driver_ind][i] == cur_param);
            VDP_drawText(str, posX, posY);
            posX += strlen(str);
        }

        posY++;
    }

    VDP_setTextPalette(PAL0);

    if (cmd == NULL) VDP_drawText("*", 0, 3);
    else VDP_drawText("*", 0, 5 + getCurrentCmdIndex());
}
Beispiel #3
0
//Processes Options Menu
void OptionsMenu()
{
    DrawBG(0);              //cls
    echo_play_bgm(BGM_03);  //Play Nes_Mes2
    DrawBG(9);

    //Init text plane (Plane, text prio, text colors)
    VDP_setTextPlan(PLAN_B);
    VDP_setTextPriority(PTRUE);
    VDP_setPaletteColor((OBJPAL * 16)+15,0xE);    //Non higlited color
    VDP_setPaletteColor((PWRPAL * 16)+15,0xEE);   //Hilited color
    VDP_setTextPalette(OBJPAL);

    InitMenu(1,0,0,7,_FALSE);                   //Init a 6 item menu
    S_ID=0;
    M_ID=0;

    //Set joy handler to Options type
    JOY_setEventHandler( &BtnOptions );

    while (SItem==0)
    {
        VDP_waitVSync();
    }
    DrawBG(0);  //cls
}
Beispiel #4
0
void OpenInGameMenu()
{
    currentLoopFunction = InGameMenuLoop;

    JOY_setEventHandler(joyEventCallback);

    menuItem = 0;

    MyVDP_waitVSync();
    VDP_setEnable(0);
    VDP_setReg(0x0b, 0x00); // set scroll mode to plane/plane
    VDP_resetSprites();

    VDP_setVerticalScroll(PLAN_A, 0);
    VDP_setVerticalScroll(PLAN_B, 0);
    VDP_setHorizontalScroll(PLAN_A, 0);
    VDP_setHorizontalScroll(PLAN_B, 0);

    VDP_updateSprites();

    VDP_fillTileMapRect(APLAN, 0, 0, 0, 64, 64);
    VDP_fillTileMapRect(BPLAN, 0, 0, 0, 64, 64);

    VDP_setTextPalette(0);

	DrawText();

    VDP_setEnable(1);
}
Beispiel #5
0
static void writeText ( u8 *str, u16 pal, u8 inc_y )
{
    u8 x = 20 - strlen ( str ) / 2;

    SYS_disableInts();
    VDP_setTextPalette ( pal );
    VDP_drawText ( prepare_string(str), x, y );
    SYS_enableInts();

    y += inc_y;
}
Beispiel #6
0
void screen_credits ()
{
    if ( DEV > 1 ) return;

    music_stop();
    displayOff(0);
    resetScreen();

    VDP_setTextPalette ( PAL0 );
    prepareColor (  1, 0xfff );
    prepareColor (  2, 0x444 );
    prepareColor ( 17, font_palette.data [ 7 ] );
    prepareColor ( 18, font_palette.data [ 8 ] );
    prepareColor ( 33, 0xfff );
    prepareColor ( 34, 0x444 );

    writeCredits ( 1, 4 );
    writeCredits ( 2, 4 );
    writeCredits ( 3, 9 );

    //waitSc(2);
}
Beispiel #7
0
Datei: main.c Projekt: clbr/SGDK
int main()
{
    u16 i, j;
    const driver_def *cur_driver;
    const cmd_def *cur_cmd;

    JOY_setEventHandler(joyEvent);

    VDP_setScreenWidth320();
    VDP_setHInterrupt(0);
    VDP_setHilightShadow(0);
    SYS_setVIntCallback(vintEvent);

    // point to first driver
    driver = &drivers[0];
    cmd = NULL;
    dmaMethod = 0;

    for(i = 0, cur_driver = drivers; i < NUM_DRIVER; i++, cur_driver++)
        for(j = 0, cur_cmd = cur_driver->cmds; j < MAX_CMD; j++, cur_cmd++)
            params_value[i][j] = cur_cmd->params;

    VDP_setPalette(PAL0, font_pal_lib.data);
    VDP_setPaletteColor((PAL1 * 16) + 15, 0x0888);
    VDP_setTextPalette(PAL0);
    VDP_drawText("Current Z80 driver", 10, 1);
    VDP_drawText("DMA Method:", 1, 26);

    refreshDriverInfos();


    while(1)
    {
        VDP_waitVSync();
    }
}
Beispiel #8
0
//Processes Credits screen
void Credits()
{
    JOY_setEventHandler( &BtnNada );    //Set Event handler to nothing
    const u8 x=1;       //Constant column value for text disp
    u8 y=1;             //Variable row ~
    const wait=3000;    //Time in MS to wait

    echo_play_bgm(BGM_14);  //Play IceHockey2
    DrawBG(0);              //cls
    DrawBG(10);             //Draw Hockey rink

    //Setup text planes and colors
    VDP_setTextPlan(PLAN_B);
    VDP_setTextPriority(PTRUE);
    VDP_setPaletteColor((OBJPAL * 16)+15,0xEE);   //Yellow
    VDP_setTextPalette(OBJPAL);

    //Draw a line, increment row, draw next line, repeat in screen chunks

    //            1234567890123456789012345678901234567
    VDP_drawText("+-----------------------------------+",x,y);y++;
    VDP_drawText("| ULTRA AIR HOCKEY (Genesis), V1.0  |",x,y);y++;
    VDP_drawText("|              Credits              |",x,y);y++;
    VDP_drawText("+-----------------------------------+",x,y);y++;
    VDP_drawText("|Producer                     Tamkis|",x,y);y++;
    VDP_drawText("|Art creator                  Tamkis|",x,y);y++;
    VDP_drawText("+-----------------------------------+",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                Music              |",x,y);y++;
    VDP_drawText("|All songs were converted to the    |",x,y);y++;
    VDP_drawText("|Echo sound engine                  |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|      Various module music artists |",x,y);y++;
    VDP_drawText("|Unless otherwise noted, all modules|",x,y);y++;
    VDP_drawText("|are from modarchive.org/           |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|http://modarchive.org/index.php?req|",x,y);y++;
    VDP_drawText("|uest=view_by_moduleid&query=NUMBER |",x,y);y++;
    VDP_drawText("v                                   v",x,y);y++;

    //wait MS, clear the text plane, repeat for next screen chunk
    waitMs(wait);
    VDP_clearPlan(BPLAN,0);
    y=1;

    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|hockey_fever.xm  The Einstein Crew |",x,y);y++;
    VDP_drawText("|144817                             |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|nes_mes2.mod        Goto80         |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|PITTITLE.mod        (Unknown)      |",x,y);y++;
    VDP_drawText("|112082                             |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|ice-hockey_94theme.mod Subtance/   |",x,y);y++;
    VDP_drawText("|inflow 121145                      |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|organmaster.mod     Gamma7         |",x,y);y++;
    VDP_drawText("|169287                             |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|intro101.mod        w.o.t.w of     |",x,y);y++;
    VDP_drawText("|supplex                            |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|hurry_up.mod        reflex/rebels  |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("v                                   v",x,y);y++;

    waitMs(wait);
    VDP_clearPlan(BPLAN,0);
    y=1;

    VDP_drawText("|slowmotion.mod     tobbx/Tobbe Lars|",x,y);y++;
    VDP_drawText("|157022                             |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|Castle_load.mod     Exodus         |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|complexity.mod      (Unknown)      |",x,y);y++;
    VDP_drawText("|92979                              |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|Reflexity_music.mod (subsong #3)   |",x,y);y++;
    VDP_drawText("|Unknown             109459         |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|chipmunks.mod       Jester/Sanity  |",x,y);y++;
    VDP_drawText("|36792                              |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|icehockey2.mod      Subversion     |",x,y);y++;
    VDP_drawText("|123683                             |",x,y);y++;
    VDP_drawText("+-----------------------------------+",x,y);y++;
    VDP_drawText("v                                   v",x,y);y++;

    waitMs(wait);
    VDP_clearPlan(BPLAN,0);
    y=1;

    VDP_drawText("|             Sound effects         |",x,y);y++;
    VDP_drawText("|Unless otherwise noted, all sfx are|",x,y);y++;
    VDP_drawText("|from Freesound.org                 |",x,y);y++;
    VDP_drawText("|http://www.freesound.org/people/   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|ID(+16) Name            URL        |",x,y);y++;
    VDP_drawText("|01      Menu highlight             |",x,y);y++;
    VDP_drawText("|broumbroum/sounds/50561/           |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|02      Menu select                |",x,y);y++;
    VDP_drawText("|Bertrof/sounds/131658/             |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|03      Puck hit                   |",x,y);y++;
    VDP_drawText("|krb21/sounds/118604/               |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|04/30   Puck deflect               |",x,y);y++;
    VDP_drawText("|BranRainey/sounds/108737/          |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("v                                   v",x,y);y++;

    waitMs(wait);
    VDP_clearPlan(BPLAN,0);
    y=1;

    VDP_drawText("|05      Bumper hit                 |",x,y);y++;
    VDP_drawText("|timgormly/sounds/170140/           |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|06      Powerup get                |",x,y);y++;
    VDP_drawText("|RandomationPictures/sounds/138491/ |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|07      Powerup use                |",x,y);y++;
    VDP_drawText("|jobro/sounds/35464/                |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|08      Goal siren                 |",x,y);y++;
    VDP_drawText("|UncleSigmund/sounds/117122/        |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|09-29   Announcer guy stuff        |",x,y);y++;
    VDP_drawText("|All generated w Acapela Box using  |",x,y);y++;
    VDP_drawText("|the English (UK) Peter voice       |",x,y);y++;
    VDP_drawText("|https://acapela-box.com/AcaBox/    |",x,y);y++;
    VDP_drawText("|index.php                          |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("v                                   v",x,y);y++;

    waitMs(wait);
    VDP_clearPlan(BPLAN,0);
    y=1;

    VDP_drawText("|31      Buzzer                     |",x,y);y++;
    VDP_drawText("|cognito%20perceptu/sounds/17468/   |",x,y);y++;
    VDP_drawText("+-----------------------------------+",x,y);y++;
    VDP_drawText("|             Beta testers          |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|DUDE #1    - Stuff                 |",x,y);y++;
    VDP_drawText("|DUDE #2    - Stuff                 |",x,y);y++;
    VDP_drawText("|DUDE #3    - Stuff                 |",x,y);y++;
    VDP_drawText("+-----------------------------------+",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|            Special Thanks         |",x,y);y++;
    VDP_drawText("|Oerg866 and SiktheHedgehog         |",x,y);y++;
    VDP_drawText("|Echo Sound Engine and related tools|",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|Stephane              Help, SGDK   |",x,y);y++;
    VDP_drawText("|Nemesis  Exodus emulator (debuging)|",x,y);y++;
    VDP_drawText("v                                   v",x,y);y++;

    waitMs(wait);
    VDP_clearPlan(BPLAN,0);
    y=1;

    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("+===================================+",x,y);y++;
    VDP_drawText("|                YOU                |",x,y);y++;
    VDP_drawText("|            FOR PLAYING!           |",x,y);y++;
    VDP_drawText("|  Ultra Air Hockey (Genesis) V1.0  |",x,y);y++;
    VDP_drawText("|        EagleSoft Ltd 2015         |",x,y);y++;
    VDP_drawText("|       www.eaglesoftltd.com        |",x,y);y++;
    VDP_drawText("+===================================+",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;
    VDP_drawText("|                                   |",x,y);y++;

    waitMs(wait);
    echo_wait_sfx(SFX_02);      //Play select sfx
    VDP_fadeOutAll(100,_FALSE);
    DrawBG(0);                  //cls
}
Beispiel #9
0
//Handles the Options menu selections
void BtnOptions(u16 joy, u16 changed, u16 state)
{
    u8 Vert=_FALSE;     //Flag if vert menu item was changed
    u8 Horiz=_FALSE;    //~       horiz ~
    char val[2];        //String holding Sound/Music test ID
    char name[25];      //String ~       Name of the sfx/music
    u8 i=0;             //Generic counter var
    u8 pal=2;           //Active palette to use (OBJPAL or PWRPAL)

    if (joy == JOY_1)
    {
        //If up pressed
        if (state & BUTTON_UP)
        {
            echo_play_sfx(SFX_01);  //HiLite
            HItem--;                //Decrement HItem, wrap if needed
            if (HItem<=MMin)
            {
                HItem=MMax-1;
            }
            //Set vert/horiz as changed
            Vert=PTRUE;
            Horiz=PTRUE;
        }
        //if up released
        else if (changed & BUTTON_UP)
        {
            //Set vert/horiz as unchanged
            Vert=_FALSE;
            Horiz=_FALSE;
        }

        //If down pressed
        if (state & BUTTON_DOWN)
        {
            echo_play_sfx(SFX_01);  //HiLite sfx
            HItem++;                //Increment
            if (HItem>=MMax)
            {
                HItem=MMin+1;
            }
            Vert=PTRUE;
            Horiz=PTRUE;
        }
        else if (changed & BUTTON_RIGHT)
        {
            Vert=_FALSE;
            Horiz=_FALSE;
        }

        //if left pressed
        if (state & BUTTON_LEFT)
        {
            //Process each for HItem row
            if (HItem==1)
            {
                //Decrement Opts[1], wrap if necessary
                Opts[1]--;
                if (Opts[1]==255)
                {
                    Opts[1]=2;
                }
            }

            //Toggle bool (!bool)
            if ((HItem>=2) && (HItem<=4))
            {
                if (Opts[HItem]==_FALSE)
                {
                    Opts[HItem]=PTRUE;
                }
                else
                {
                    Opts[HItem]=_FALSE;
                }

                //If toggling music
                if (HItem==3)
                {
                    //If false, stop BGM; else play Nes_Mes2 again
                    if (Opts[HItem]==_FALSE)
                    {
                        echo_stop_bgm();
                    }
                    else
                    {
                        echo_play_bgm(BGM_03);
                    }
                }
            }

            //If Sound test
            if (HItem==6)
            {
                //Decremenet S_ID, wrap if necessary
                S_ID--;
                if (S_ID<0)
                {
                    S_ID=S_Max;
                }
            }

            //If music test, decrement M_ID, wrap if necessary
            if (HItem==5)
            {
                M_ID--;
                if (M_ID<0)
                {
                    M_ID=M_Max;
                }
            }

            echo_play_sfx(SFX_02);  //Select
            Horiz=PTRUE;            //Flag horiz as changed
        }
        //If released
        else if (changed & BUTTON_LEFT)
        {
            Horiz=_FALSE;   //Unflag Horiz
        }

        //If right pressed
        if (state & BUTTON_RIGHT)
        {
            //Process each HItem row
            //Difficulty, increment, wrap as necessary
            if (HItem==1)
            {
                Opts[1]++;
                if (Opts[1]>2)
                {
                    Opts[1]=_FALSE;
                }
            }

            //Toggle bools (!bool)
            if ((HItem>=2) && (HItem<=4))
            {
                if (Opts[HItem]==_FALSE)
                {
                    Opts[HItem]=PTRUE;
                }
                else
                {
                    Opts[HItem]=_FALSE;
                }

                //If toggling music, stop bgm if false; else play Nes_Mes2
                if (HItem==3)
                {
                    if (Opts[HItem]==_FALSE)
                    {
                        echo_stop_bgm();
                    }
                    else
                    {
                        echo_play_bgm(BGM_03);
                    }
                }
            }

            //If Sound test, increment S_ID, wrap if necessary
            if (HItem==6)
            {
                S_ID++;
                if (S_ID>S_Max)
                {
                    S_ID=0;
                }
            }

            //If Music test, increment M_ID, wrap if necessary
            if (HItem==5)
            {
                M_ID++;
                if (M_ID>M_Max)
                {
                    M_ID=0;
                }
            }

            echo_play_sfx(SFX_02);  //Select sfx
            Horiz=PTRUE;            //Flag Horiz as changed
        }
        //if released, unflag horiz
        else if (changed & BUTTON_RIGHT)
        {
            Horiz=_FALSE;
        }


        //If A button pressed
        if (state & BUTTON_A)
        {
            //If Sound test, play the selected S_ID
            if (HItem==6)
            {
                echo_play_sfx(Sounds[S_ID]);
            }

            //if Music test, play the selected M_ID
            if (HItem==5)
            {
                echo_play_bgm(Songs[M_ID]);
            }
        }

        //If Start button pressed
        if (state & BUTTON_START)
        {
            echo_play_sfx(SFX_03);  //Play hockey deflect sfx
            SItem=1;                //Select item
        }

        //If vert changed
        if (Vert==PTRUE)
        {
            //Clear text rows
            for (i=10;i<=16;i++)
            {
                VDP_clearText(5, i, 1);
            }

            //Set to PWRPAL
            VDP_setTextPalette(PWRPAL);
            VDP_drawText(">",5,HItem+10);   //Disp hilighted row
        }

        //If Horiz changed
        if (Horiz==PTRUE)
        {
            //Get/set appropriate palette
            if (HItem==1){pal=PWRPAL;}else{pal=OBJPAL;}
            VDP_setTextPalette(pal);

            //Draw difficulty text and selected difficulty
            VDP_drawText("Difficulty:",6,11);
            VDP_drawText("      ",20,11);
            switch(Opts[1])
            {
                case 0:
                    VDP_drawText("Easy",20,11);
                    break;
                case 1:
                    VDP_drawText("Medium",20,11);
                    break;
                case 2:
                    VDP_drawText("Hard",20,11);
                    break;
            }

            //Get/set palettes, show lables for powerups, music, and sound toggles
            if (HItem==2){pal=PWRPAL;}else{pal=OBJPAL;}
            VDP_setTextPalette(pal);
            VDP_drawText("Powerups",6,12);

            if (HItem==3){pal=PWRPAL;}else{pal=OBJPAL;}
            VDP_setTextPalette(pal);
            VDP_drawText("Music:",6,13);

            if (HItem==4){pal=PWRPAL;}else{pal=OBJPAL;}
            VDP_setTextPalette(pal);
            VDP_drawText("Sfx:",6,14);

            //Show selected boolean states for them, with appropriate palette
            for (i=2;i<=4;i++)
            {
                if (HItem==i){pal=PWRPAL;}else{pal=OBJPAL;}
                VDP_setTextPalette(pal);
                if (Opts[i]==_FALSE)
                {
                    VDP_drawText("OFF",20,10+i);
                }
                else
                {
                    VDP_drawText("ON ",20,10+i);
                }
            }

            //Ditto for Music test
            if (HItem==5){pal=PWRPAL;}else{pal=OBJPAL;}
            VDP_setTextPalette(pal);
            VDP_drawText("Music test:",6,15);
            VDP_drawText("  ",20,15);
            intToStr(M_ID,val,1);       //Convert M_ID to string
            VDP_drawText(val,20,15);    //Display it

            //Ditto for Sound test
            if (HItem==6){pal=PWRPAL;}else{pal=OBJPAL;}
            VDP_setTextPalette(pal);
            VDP_drawText("Sound test:",6,16);
            VDP_drawText("  ",20,16);
            intToStr(S_ID,val,1);
            VDP_drawText(val,20,16);

            //If Sound/music test
            if ((HItem==5)||(HItem==6))
            {
                //Fetch and show the music/sound name
                VDP_setTextPalette(PWRPAL);
                if (HItem==5)
                {
                    VDP_drawText("Song title: ",6,18);
                    VDP_drawText("                                  ",6,19);
                    VDP_drawText(Song_Names[M_ID],6,19);//@Get song title here
                }
                else
                {
                    VDP_drawText("Sound title:",6,18);
                    VDP_drawText("                                  ",6,19);
                    VDP_drawText(Sound_Names[S_ID],6,19);//Get sfx title here
                }
            }
            else
            {
                //If neither, clear the lines
                VDP_drawText("                                  ",6,18);
                VDP_drawText("                                  ",6,19);
            }
        }
    }
}
Beispiel #10
0
Datei: main.c Projekt: clbr/SGDK
static void setTextPalette(u16 selected)
{
    if (selected) VDP_setTextPalette(PAL0);
    else VDP_setTextPalette(PAL1);
}
Beispiel #11
0
int main() {
	u16 i, newJoy = 0, oldJoy = 0, autoRepeatDelay = 0, redraw = 1;
	s16 choice = 0;
	const char *str;
	struct FileSystem fs;
	u16 numFiles;

	// Init the screen, display message
	VDP_setScreenWidth320();
	VDP_setHInterrupt(0);
	VDP_setHilightShadow(0);
	VDP_setTextPalette(PAL0);
	VDP_drawText("MakeStuff USB MegaDrive Dev Kit v2", 3, 10);
	VDP_drawText("Reading SD-card...", 11, 12);

	// Initialise the SD card
	sdInit();

	// Get the geometry of the first SD-card partition
	fatOpenFileSystem(&fs);

	// Initialise workspace for the directory list
	initFiles((u16*)0x440000);

	// Get the list of game ROMs
	fatListDirectory(&fs, fs.rootDirCluster, storeFile);

	// Sort the list alphabetically
	numFiles = dirPtr - dirList;
	quickSort((CVPtr *)dirList, 0, numFiles, (CompareFunc)myFileComp);

	// Display the list
	for ( ; ; ) {
		newJoy = JOY_readJoypad(0);
		if ( newJoy & BUTTON_UP && choice > 0 ) {
			if ( !(oldJoy & BUTTON_UP) ) {
				choice--; redraw = 1;
				autoRepeatDelay = 0;
			} else {
				if ( autoRepeatDelay == 10 ) {
					choice--; redraw = 1;
				} else {
					autoRepeatDelay++;
				}
			}
		}
		if ( newJoy & BUTTON_DOWN && choice < numFiles-1 ) {
			if ( !(oldJoy & BUTTON_DOWN) ) {
				choice++; redraw = 1;
				autoRepeatDelay = 0;
			} else {
				if ( autoRepeatDelay == 10 ) {
					choice++; redraw = 1;
				} else {
					autoRepeatDelay++;
				}
			}
		}
		if ( newJoy & BUTTON_START ) {
			doSelect(&fs, choice);
		}
		oldJoy = newJoy;
		
		VDP_waitVSync();
		if ( redraw ) {
			VDP_clearPlan(VDP_PLAN_A, 1);
			VDP_waitDMACompletion();
			for ( i = 2; i < 26; i++ ) {
				if ( i >= 11-choice && i < numFiles-choice+11 ) {
					str = dirList[choice+i-11]->fileName;
					if ( i == 11 ) {
						VDP_setTextPalette(PAL1);
						VDP_drawText(str, 2, i);
						VDP_setTextPalette(PAL0);
					} else {
						VDP_drawText(str, 2, i);
					}
				}
			}
		}
		redraw = 0;
	}
}