Exemple #1
0
int ProcessCmdLine()
{
	unsigned int i;
	int nOptX = 0, nOptY = 0, nOptD = 0;
	int nOpt1Size;
	TCHAR szOpt2[3] = _T("");
	TCHAR szName[MAX_PATH];

	if (szCmdLine[0] == _T('\"')) {
		int nLen = _tcslen(szCmdLine);
		nOpt1Size = 1;
		while (szCmdLine[nOpt1Size] != _T('\"') && nOpt1Size < nLen) {
			nOpt1Size++;
		}
		if (nOpt1Size == nLen) {
			szName[0] = 0;
		} else {
			nOpt1Size++;
			_tcsncpy(szName, szCmdLine + 1, nOpt1Size - 2);
			szName[nOpt1Size - 2] = 0;
		}
	} else {
		int nLen = _tcslen(szCmdLine);
		nOpt1Size = 0;
		while (szCmdLine[nOpt1Size] != _T(' ') && nOpt1Size < nLen) {
			nOpt1Size++;
		}
		_tcsncpy(szName, szCmdLine, nOpt1Size);
		szName[nOpt1Size] = 0;
	}

	if (_tcslen(szName)) {
		if (_tcscmp(szName, _T("-listinfo")) == 0) {
			write_datfile(0, 0, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listinfowithmd")) == 0) {
			write_datfile(0, 1, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listinfomdonly")) == 0) {
			write_datfile(0, 2, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listextrainfo")) == 0) {
			int nWidth;
			int nHeight;
			int nAspectX;
			int nAspectY;
			for (i = 0; i < nBurnDrvCount; i++) {
				nBurnDrvSelect = i;
				BurnDrvGetVisibleSize(&nWidth, &nHeight);
				BurnDrvGetAspect(&nAspectX, &nAspectY);
				printf("%s\t%ix%i\t%i:%i\t0x%08X\t\"%s\"\t%i\t%i\t%x\t%x\t\"%s\"\n", BurnDrvGetTextA(DRV_NAME), nWidth, nHeight, nAspectX, nAspectY, BurnDrvGetHardwareCode(), BurnDrvGetTextA(DRV_SYSTEM), BurnDrvIsWorking(), BurnDrvGetMaxPlayers(), BurnDrvGetGenreFlags(), BurnDrvGetFamilyFlags(), BurnDrvGetTextA(DRV_COMMENT));
			}			
			return 1;
		}
	}

	_stscanf(&szCmdLine[nOpt1Size], _T("%2s %i x %i x %i"), szOpt2, &nOptX, &nOptY, &nOptD);

	if (_tcslen(szName)) {
		bool bFullscreen = 1;
		bCmdOptUsed = 1;

		if (_tcscmp(szOpt2, _T("-r")) == 0) {
			if (nOptX && nOptY) {
				nVidWidth = nOptX;
				nVidHeight = nOptY;
			}
			if (nOptD) {
				nVidDepth = nOptD;
			}
		} else {
			if (_tcscmp(szOpt2, _T("-a")) == 0) {
				bVidArcaderes = 1;
			} else {
				if (_tcscmp(szOpt2, _T("-w")) == 0) {
					bCmdOptUsed = 0;
					bFullscreen = 0;
				}
			}
		}

		if (bFullscreen) {
			nVidFullscreen = 1;
		}

		if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fs")) == 0) {
			if (BurnStateLoad(szName, 1, &DrvInitCallback)) {
				return 1;
			} else {
//				bRunPause = 1;
			}
		} else {
			if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fr")) == 0) {
				if (StartReplay(szName)) {
					return 1;
				}
			} else {
				for (i = 0; i < nBurnDrvCount; i++) {
					nBurnDrvSelect = i;
					if (_tcscmp(BurnDrvGetText(DRV_NAME), szName) == 0) {
						MediaInit();
						DrvInit(i, true);
						break;
					}
				}
				if (i == nBurnDrvCount) {
					FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_NOSUPPORT), szName, _T(APP_TITLE));
					FBAPopupDisplay(PUF_TYPE_ERROR);
					return 1;
				}
			}
		}
	}

	POST_INITIALISE_MESSAGE;

	if (!nVidFullscreen) {
		MenuEnableItems();
	}

	return 0;
}
Exemple #2
0
static void process_key( int key, int down, int repeat )
{
    if ( !down ) return ;
    switch( nGameStage ) {
    /* ---------------------------- Main Menu ---------------------------- */
    case 1:
        //ui_mainmenu_select
        switch( key ) {
        case PSP_CTRL_UP:
            if (ui_mainmenu_select <= 0) break;
            ui_mainmenu_select--;
            draw_ui_main();
            break;
        case PSP_CTRL_DOWN:
            if (ui_mainmenu_select >=9 ) break;
            ui_mainmenu_select++;
            draw_ui_main();
            break;

        case PSP_CTRL_LEFT:
            switch(ui_mainmenu_select) {
            case 7:
                if ( cpu_speeds_select > 0 ) {
                    cpu_speeds_select--;
                    draw_ui_main();
                }
                break;
            }
            break;
        case PSP_CTRL_RIGHT:
            switch(ui_mainmenu_select) {
            case 7:
                if ( cpu_speeds_select < 3 ) {
                    cpu_speeds_select++;
                    draw_ui_main();
                }
                break;
            }
            break;

        case PSP_CTRL_CIRCLE:
            switch( ui_mainmenu_select ) {
            case 0:
                nGameStage = 2;
                strcpy(ui_current_path, szAppRomPath);
                //ui_current_path[strlen(ui_current_path)-1] = 0;
                draw_ui_browse(true);
                break;
            case 8: // Return to Game
                if ( nPrevGame < nBurnDrvCount ) {
                    scePowerSetClockFrequency(
                        cpu_speeds[cpu_speeds_select].cpu,
                        cpu_speeds[cpu_speeds_select].cpu,
                        cpu_speeds[cpu_speeds_select].bus );
                    nGameStage = 0;
                }
                break;
            case 9:	// Exit
                bGameRunning = 0;
                break;

            }
            break;
        }
        break;
    /* ---------------------------- Rom Browse ---------------------------- */
    case 2:
        switch( key ) {
        case PSP_CTRL_UP:
            if (find_rom_select == 0) break;
            if (find_rom_top >= find_rom_select) find_rom_top--;
            find_rom_select--;
            draw_ui_browse(false);
            break;
        case PSP_CTRL_DOWN:
            if ((find_rom_select+1) >= find_rom_count) break;
            find_rom_select++;
            if ((find_rom_top + find_rom_list_cnt) <= find_rom_select) find_rom_top++;
            draw_ui_browse(false);
            break;
        case PSP_CTRL_CIRCLE:
            switch( getRomsFileStat(find_rom_select) ) {
            case -1:	// directry
            {   // printf("change dir %s\n", getRomsFileName(find_rom_select) );
                char * pn = getRomsFileName(find_rom_select);
                if ( strcmp("..", pn) ) {
                    strcat(ui_current_path, getRomsFileName(find_rom_select));
                    strcat(ui_current_path, "/");
                } else {
                    if (strlen(strstr(ui_current_path, ":/")) == 2) break;	// "ROOT:/"
                    for(int l = strlen(ui_current_path)-1; l>1; l-- ) {
                        ui_current_path[l] = 0;
                        if (ui_current_path[l-1] == '/') break;
                    }
                }
                //printf("change dir to %s\n", ui_current_path );
                find_rom_count = 0;
                find_rom_select = 0;
                find_rom_top = 0;
                draw_ui_browse(true);
            }
            break;
            default: // rom zip file
            {
                nBurnDrvSelect = (unsigned int)getRomsFileStat( find_rom_select );
                if (nBurnDrvSelect <= nBurnDrvCount && BurnDrvIsWorking() ) {

                    if ( DrvInit( nBurnDrvSelect, false ) == 0 ) {

                        BurnRecalcPal();
                        InpInit();
                        InpDIP();

                        scePowerSetClockFrequency(
                            cpu_speeds[cpu_speeds_select].cpu,
                            cpu_speeds[cpu_speeds_select].cpu,
                            cpu_speeds[cpu_speeds_select].bus );
                        nGameStage = 0;

                    } else
                        nBurnDrvSelect = ~0U;

                } else
                    nBurnDrvSelect = ~0U;

                nPrevGame = nBurnDrvSelect;

                //if (nBurnDrvSelect == ~0U) {
                //	bprintf(0, "unkown rom %s", getRomsFileName(find_rom_select));
                //}
            }



            }
            break;
        case PSP_CTRL_CROSS:	// cancel
            nGameStage = 1;
            draw_ui_main();
            break;
        }
        break;
    /* ---------------------------- DIP Setting ---------------------------- */
    case 3:

        break;

    }
}