コード例 #1
0
ファイル: application.cpp プロジェクト: Themaister/bsnes-Qt
int Application::main(int &argc, char **argv) {
    app = new App(argc, argv);
#if !defined(PLATFORM_WIN)
    app->setWindowIcon(QIcon(":/bsnes.png"));
#else
    //Windows port uses 256x256 icon from resource file
    CoInitialize(0);
    utf8_args(argc, argv);
#endif

    initPaths(argv[0]);
    locateFile(configFilename = "bsnes-qt.cfg", true);
    locateFile(styleSheetFilename = "style.qss", false);

    string customStylesheet;
    if(customStylesheet.readfile(styleSheetFilename) == true) {
        app->setStyleSheet((const char*)customStylesheet);
    } else {
        app->setStyleSheet(defaultStylesheet);
    }

    config().load(configFilename);
    mapper().bind();
    init();

    //initialize libsnes
    snes_set_video_refresh(bsnes_video_refresh);
    snes_set_audio_sample(bsnes_audio_sample);
    snes_set_input_poll(bsnes_input_poll);
    snes_set_input_state(bsnes_input_state);
    snes_init();

    //this used to disable the option if libsupergame was not installed;
    //after porting bsnes-qt to a standalone application, that's not possible through libsnes
    mainWindow->system_loadSpecial_superGameBoy->setVisible(true);

    if(argc == 2) {
        //if valid file was specified on the command-line, attempt to load it now
        cartridge.loadNormal(argv[1]);
    }

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(run()));
    timer->start(0);
    app->exec();

    //QbWindow::close() saves window geometry for next run
    for(unsigned i = 0; i < windowList.size(); i++) {
        windowList[i]->close();
    }

    cartridge.unload();
    config().save(configFilename);
    return 0;
}
コード例 #2
0
ファイル: libsnes_pwrap.cpp プロジェクト: zeromus/BizHawk
void InitBsnes()
{
	//setup all hooks to forward messages to the frontend
	snes_set_video_refresh(snes_video_refresh);
	snes_set_audio_sample(snes_audio_sample);
	snes_set_input_poll(snes_input_poll);
	snes_set_input_state(snes_input_state);
	snes_set_input_notify(snes_input_notify);
	snes_set_path_request(snes_path_request);
	
	snes_set_allocSharedMemory(snes_allocSharedMemory);
	snes_set_freeSharedMemory(snes_freeSharedMemory);
}