コード例 #1
0
ファイル: main.c プロジェクト: VWarlock/my_demos
int main(int argc, char *argv[])
{
    uint8_t *hsc;
    uint32_t lp;
    hsc=hsc_load("TECHNO.HSC");
    if(hsc==NULL)
    {
        printf("lostship.hsc not found. \n");
        return 3;
    }
    SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER);
    sound_init();
    start_opl_emulation();

    hsc_play(hsc,1);
    while(hsc_get_status())
    {
        if(lp!=hsc_get_pattpos())
        {
            printf("status - %d; pos - %d; pattpos - %d                       \r",hsc_get_status(),hsc_get_pos(),hsc_get_pattpos());
            lp=hsc_get_pattpos();
            fflush(stdout);
            usleep(100000);
        }
    }
    
    sound_end();
    return 0;
}
コード例 #2
0
ファイル: eo.c プロジェクト: libretro/81-libretro
int eo_init( CONFIG* cfg )
{
  /* From main_.cpp */
  
  ATA_Init();
  sound_init();
  load_config();
  
  zx81.cwd[ 0 ] = 0;
  zx81.temppath[ 0 ] = 0;
  zx81.inipath[ 0 ] = 0;
  zx81.configpath[ 0 ] = 0;
  
  //RenderInit();
  SP0256_Init();

  AnimTimer1_Interval = 20;
  Timer2_Interval = 1000;

  //AccurateInit();
  
  int res = internal_init( cfg );
  
  AnimTimer1_Interval *= 1000;
  Timer2_Interval *= 1000;
  
  AnimTimer1_Count = AnimTimer1_Interval;
  return res;
}
コード例 #3
0
ファイル: mvs.c プロジェクト: AMSMM/NJEMU
void neogeo_main(void)
{
	Loop = LOOP_RESET;

	while (Loop >= LOOP_RESTART)
	{
		Loop = LOOP_EXEC;

		ui_popup_reset();

		fatal_error = 0;

		video_clear_screen();

		if (memory_init())
		{
			if (sound_init())
			{
				if (input_init())
				{
					if (neogeo_init())
					{
						neogeo_run();
					}
					neogeo_exit();
				}
				input_shutdown();
			}
			sound_exit();
		}
		memory_shutdown();
		show_fatal_error();
	}
}
コード例 #4
0
ファイル: main.cpp プロジェクト: HerbFargus/AtomBomberman
int init()
{
	srand(time(0) ^ getpid());
	
	if (SDL_Init(0) < 0)
	{
		fprintf(stderr, "Error initialising SDL: %s\n", SDL_GetError());
		return -1;
	}
	
	if (config_init() == -1 ||
		input_init() == -1 ||
	    graphics_init() == -1 ||
	    sound_init() == -1 ||
	    level_init() == -1 ||
	    bomber_init() == -1 ||
	    bomb_init() == -1)
	{
		return -1;
	}
	
	// load images/animations - its done up ^ in init's
	
	// init calc_delta_time
	calc_delta_time();
	
	return 0;
}
コード例 #5
0
ファイル: emu.c プロジェクト: mcandre/PebbleGameboyEmulator
bool emu_load_cart(const char *file_name) {
	FILE *f = fopen(file_name, "rb");
	if (f) {
		// Détermine la taille du fichier
		unsigned size = get_file_size(f);
		// Garde pour les sauvegardes d'état
		strcpy(emu_file_name, file_name);
		// Au moins un tableau couvrant la map 0000-7FFF...
		size = max(size, 0x8000);
		// Et multiple d'une page (arrondissement à la page supérieure)
		size = ((size + 0x3FFF) / 0x4000) * 0x4000;
		mem_rom = malloc(size);
		// La cartouche préparée, prépare le CPU
		cpu_init();
		lcd_init();
		sound_init();
		mem_init();
		// Charge le contenu
		fread(mem_rom, size, 1, f);
		fclose(f);
		// Démarrage
		mbc_init(size);
		load_sram();
		// Color-It
		ColorIt_init(file_name, mem_rom);
		return true;
	}
	return false;
}
コード例 #6
0
ファイル: main.c プロジェクト: y-salnikov/my_demos
int main(int argc, char *argv[])
{
    const char bar_length=50;
    dro_status drost;
    const char spin[]="-\\|/";
    int spin_index=0;
    int i;

    SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER);
    sound_init();
    start_opl_emulation();

    dro_load(data,data_length);
    dro_play(2);
    do
    {
        dro_get_status(&drost);
        printf("%c[",spin[spin_index]);
        for(i=0; i<bar_length-3; i++)
        {
            if (i<((float)drost.position/drost.length)*(bar_length-3)) printf("=");
            else printf(".");
        }
        printf("]\r");
        fflush(stdout);
        usleep(100000);
        spin_index=(spin_index+1) % 4;
    } while(drost.playing);
    usleep(1000000);

    dro_stop();
    sound_end();
    return 0;
}
コード例 #7
0
ファイル: system_sound.c プロジェクト: Cpasjuste/neopop-sdl
void
system_sound_chipreset(void)
{

    sound_init(samplerate);
    return;
}
コード例 #8
0
ファイル: BIKPlayer.cpp プロジェクト: scriptedfate/gemrb
int BIKPlayer::doPlay()
{
	int done = 0;

	//bink is always truecolor
	g_truecolor = 1;

	frame_wait = 0;
	timer_last_sec = 0;
	video_frameskip = 0;

	if (sound_init( core->GetAudioDrv()->CanPlay())) {
		//sound couldn't be initialized
		return 1;
	}

	//last parameter is to enable YUV overlay
	outputwidth = (int) header.width;
	outputheight= (int) header.height;
	video->InitMovieScreen(outputwidth,outputheight, true);

	if (video_init(outputwidth,outputheight)) {
		return 2;
	}

	while (!done && next_frame()) {
		done = video->PollMovieEvents();
	}

	return 0;
}
コード例 #9
0
/* in case UserDef was read, we re-initialize all, and do versioning */
static void wm_init_userdef(bContext *C, const bool from_memory)
{
	/* versioning is here */
	UI_init_userdef();
	
	MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
	sound_init(CTX_data_main(C));

	/* needed so loading a file from the command line respects user-pref [#26156] */
	if (U.flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
	else G.fileflags &= ~G_FILE_NO_UI;

	/* set the python auto-execute setting from user prefs */
	/* enabled by default, unless explicitly enabled in the command line which overrides */
	if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
		if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |=  G_SCRIPT_AUTOEXEC;
		else G.f &= ~G_SCRIPT_AUTOEXEC;
	}

	/* avoid re-saving for every small change to our prefs, allow overrides */
	if (from_memory) {
		UI_init_userdef_factory();
	}

	/* update tempdir from user preferences */
	BLI_init_temporary_dir(U.tempdir);

	BKE_userdef_state();
}
コード例 #10
0
ファイル: PICvision.c プロジェクト: Picatout/PICvision
void PICvision_init(void) {
    HardwareConfig();
    timers_init(TICK_FREQ);
    video_init();
    sound_init(1000/TICK_FREQ);
    splash_screen();
}//f()
コード例 #11
0
int main(int argc, char **argv)
{
    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);

    SDL_CreateWindowAndRenderer(SCREEN_WIDTH+232, SCREEN_HEIGHT+16, 0, &displayWindow, &displayRenderer);
    SDL_GetRendererInfo(displayRenderer, &displayRendererInfo);
    SDL_SetRenderDrawBlendMode(displayRenderer, SDL_BLENDMODE_BLEND);

    SCREEN_SHIFT_X = 8;
    SCREEN_SHIFT_Y = 8;

#ifdef __EMSCRIPTEN__
    emscripten_set_main_loop(null_loop_iter, 60, 1);
#endif

    srand(time(NULL));
    sound_init();
    resizeWindow(SCREEN_WIDTH, SCREEN_HEIGHT);
    load_resources();

    last_time = clock();

#ifdef __EMSCRIPTEN__
    emscripten_set_main_loop(loop_iter, 60, 1);
#else
    while (!done)
    {
        loop_iter();
    }
#endif

    sound_exit();
    Quit(0);
    return (0);
}
コード例 #12
0
ファイル: game.c プロジェクト: IGLOU-EU/yirl
int ygInit(GameConfig *cfg)
{
  static int t;

  /* Init parseurs */
  CHECK_AND_RET(t = ydJsonInit(), -1, -1,
		    "json init failed");
  CHECK_AND_RET(jsonManager = ydNewManager(t), NULL, -1,
		    "json init failed");
  parsers[t] = jsonManager;

  /* Init scripting */
  /* TODO init internal lua function */
  CHECK_AND_RET(t = ysLuaInit(), -1, -1, "lua init failed");
  CHECK_AND_RET(luaManager = ysNewManager(NULL, t), NULL, -1,
		    "lua init failed");

  CHECK_AND_RET(yesLuaRegister(luaManager), -1, -1, "lua init failed");

  /* Init widgets */
  CHECK_AND_RET(ywidInitCallback(), -1, -1, "can not init callback");
  CHECK_AND_RET(ywinAddCallback(ywinCreateNativeCallback("FinishGame",
							 ygTerminateCallback)),
		-1, -1, "can not add game's callback");
  CHECK_AND_RET(ywMenuInit(), -1, -1, "Menu init failed");
  CHECK_AND_RET(ywMapInit(), -1, -1, "Map init failed");
  CHECK_AND_RET(ywTextScreenInit(), -1, -1, "Text Screen init failed");
  CHECK_AND_RET(ywContenerInit(), -1, -1, "Contener init failed");

  /* Init sound */
  sound_init(LIB_VLC);

  for (GList *tmp = cfg->rConf; tmp; tmp = tmp->next) {
    //TODO check which render to use :)
    if (yuiStrEqual(TO_RC(tmp->data)->name, "curses")) {
#ifdef WITH_CURSES
      ycursInit();
      CHECK_AND_RET(ycursRegistreMenu(), -1, -1, "Menu init failed");
      CHECK_AND_RET(ycursRegistreTextScreen(), -1, -1,
			"Text Screen init failed");
      CHECK_AND_RET(ycursRegistreMap(), -1, -1, "Map init failed");
#else
      /* print error */
#endif
    } else if (yuiStrEqual(TO_RC(tmp->data)->name, "sdl2")) {
#ifdef WITH_SDL
      ysdl2Init();
      CHECK_AND_RET(ysdl2RegistreTextScreen(), -1, -1,
			"Text Screen init failed");
      CHECK_AND_RET(ysdl2RegistreMenu(), -1, -1, "Menu init failed");
      CHECK_AND_RET(ysdl2RegistreMap(), -1, -1, "Map init failed");
#else
      /* print error */
#endif
    }
  }
  init = 1;
  return 0;
}
コード例 #13
0
ファイル: AY8910.c プロジェクト: jvernet/apple2
void AY8910_InitAll(int nClock, unsigned long nSampleRate)
{
	for (unsigned int i=0; i<MAX_8910; i++)
	{
		sound_init(&g_AY8910[i], NULL, nSampleRate);	// Inits mainly static members (except ay_tick_incr)
		sound_ay_init(&g_AY8910[i]);
	}
}
コード例 #14
0
ファイル: AY8910.c プロジェクト: jvernet/apple2
void AY8910_InitClock(int nClock, unsigned long nSampleRate)
{
	SetCLK( (double)nClock );
	for (unsigned int i=0; i<MAX_8910; i++)
	{
		sound_init(&g_AY8910[i], NULL, nSampleRate);	// ay_tick_incr is dependent on AY_CLK
	}
}
コード例 #15
0
void sounds_init(void)
{
	sound_init();

	sound_burning = sound_load_sample(BURN_FILE);
	sound_bulbul = sound_load_sample(BULBUL_FILE);
	sound_sinked = sound_load_sample(SINKED_FILE);
	sound_missed = sound_load_sample(MISSED_FILE);
}
コード例 #16
0
ファイル: colecovision.c プロジェクト: OpenEmu/CrabEmu-Core
int coleco_init(int video_system) {
    int i;
    float tmp;
    int region = SMS_REGION_EXPORT;

    if(video_system == SMS_VIDEO_NTSC) {
        tmp = NTSC_Z80_CLOCK / PSG_DIVISOR / NTSC_FPS / NTSC_LINES_PER_FRAME /
              NTSC_CLOCKS_PER_SAMPLE;

        for(i = 0; i < NTSC_LINES_PER_FRAME; ++i) {
            psg_samples[i] = (uint32) (tmp * (i + 1)) -
                             (uint32) (tmp * i);
        }

        /* We end up generating 734 samples per frame @ 44100 Hz, 60fps, but we
           need 735. */
        psg_samples[261] += 1;

        region |= SMS_VIDEO_NTSC;

        sn76489_init(&psg, NTSC_Z80_CLOCK, 44100.0f,
                     SN76489_NOISE_BITS_NORMAL, SN76489_NOISE_TAPPED_NORMAL);
    }
    else {
        tmp = PAL_Z80_CLOCK / PSG_DIVISOR / PAL_FPS / PAL_LINES_PER_FRAME /
              PAL_CLOCKS_PER_SAMPLE;

        for(i = 0; i < PAL_LINES_PER_FRAME; ++i) {
            psg_samples[i] = (uint32) (tmp * (i + 1)) -
                             (uint32) (tmp * i);
        }

        /* We need 882 samples per frame @ 44100 Hz, 50fps. */
        region |= SMS_VIDEO_PAL;

        sn76489_init(&psg, PAL_Z80_CLOCK, 44100.0f,
                     SN76489_NOISE_BITS_NORMAL, SN76489_NOISE_TAPPED_NORMAL);
    }

    sms_region = region;

    gui_set_console((console_t *)&colecovision_cons);

    coleco_mem_init();

    sms_vdp_init(video_system, 0);
    sms_z80_init();
    sound_init(2, video_system);

    sms_z80_set_pread(&coleco_port_read);
    sms_z80_set_pwrite(&coleco_port_write);
    cycles_run = cycles_to_run = scanline = 0;

    colecovision_cons._base.initialized = 1;

    return 0;
}
コード例 #17
0
ファイル: sound.c プロジェクト: matthewbauer/fuse-libretro
void
sound_unpause( void )
{
  /* No sound if fastloading in progress */
  if( settings_current.fastload && tape_is_playing() )
    return;

  sound_init( settings_current.sound_device );
}
コード例 #18
0
ファイル: machine.c プロジェクト: twinaphex/sdcell
static int
machine_select_machine( fuse_machine_info *machine )
{
  int width, height, i;
  int capabilities;

  machine_current = machine;

  settings_set_string( &settings_current.start_machine, machine->id );
  
  tstates = 0;

  /* Reset the event stack */
  event_reset();
  if( event_add( 0, timer_event ) ) return 1;
  if( event_add( machine->timings.tstates_per_frame, spectrum_frame_event ) )
    return 1;

  sound_end();

  if( uidisplay_end() ) return 1;

  capabilities = libspectrum_machine_capabilities( machine->machine );

  /* Set screen sizes here */
  if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_VIDEO ) {
    width = DISPLAY_SCREEN_WIDTH;
    height = 2*DISPLAY_SCREEN_HEIGHT;
  } else {
    width = DISPLAY_ASPECT_WIDTH;
    height = DISPLAY_SCREEN_HEIGHT;
  }

  if( uidisplay_init( width, height ) ) return 1;

  sound_init( settings_current.sound_device );

  /* Mark RAM as not-present/read-only. The machine's reset function will
   * mark available pages as present/writeable.
   */
  for( i = 0; i < 2 * SPECTRUM_RAM_PAGES; i++ )
    memory_map_ram[i].writable = 0;

  /* Do a hard reset */
  if( machine_reset( 1 ) ) return 1;

  /* And the dock menu item */
  if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_DOCK ) {
    ui_menu_activate( UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT, 0 );
  }

  /* Reset any dialogue boxes etc. which contain machine-dependent state */
  ui_widgets_reset();

  return 0;
}
コード例 #19
0
ファイル: smssystem.cpp プロジェクト: Cpasjuste/libarcade
void system_init(void)
{
    sms_init();
    pio_init();
    vdp_init();
    render_init();
    sound_init();

    sms.save = 0;
}
コード例 #20
0
blargg_err_t Music_Player::init( long rate )
{
	sample_rate = rate;
	
	int min_size = sample_rate * 2 / fill_rate;
	int buf_size = 512;
	while ( buf_size < min_size )
		buf_size *= 2;
	
	return sound_init( sample_rate, buf_size, fill_buffer, this );
}
コード例 #21
0
int main(int argc, char *argv[])
{
	gfx_width=640; gfx_height=480;
	gfx_fullscreen=0;

	c_minx=0;
	c_miny=0;
	c_maxx=gfx_width;
	c_maxy=gfx_height;

	fprintf(stderr, "Strange Adventures in Infinite Space - v" SAIS_VERSION_STRING "\n");
	fprintf(stderr, "Unofficial fork by Philip Boulain et. al. (see README.md)\n");

	if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0)
	{
		fprintf(stderr, "Problem initialising SDL: %s\n", SDL_GetError());
		return 1;
	}
	SDL_WM_SetCaption("Strange Adventures In Infinite Space", "Strange Adventures In Infinite Space");

	// Enable UNICODE so we can emulate getch() in text input
	SDL_EnableUNICODE(1);

	// init SDL mixer
	if (Mix_OpenAudio(22050, AUDIO_S16, 2, 1024) < 0)
	{
		fprintf(stderr, "Problem initialising Audio: %s\n", SDL_GetError());
		return 1;
	}
	Mix_AllocateChannels(16);
	sound_init();

	// Must find the native resolution *before* setting the video mode
	const SDL_VideoInfo* video_info = SDL_GetVideoInfo();
	g_native_resolution.w = video_info->current_w;
	g_native_resolution.h = video_info->current_h;

	g_virtual_resolution.x = 0;
	g_virtual_resolution.y = 0;
	g_virtual_resolution.w = gfx_width;
	g_virtual_resolution.h = gfx_height;

	sdlsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, gfx_width, gfx_height, 8,
		0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff);

	g_scaled_video = NULL;
	gfx_window_width  = gfx_width; // Start at 1:1 size
	gfx_window_height = gfx_height;
	gfx_resize();

	my_main();

	return 0;
}
コード例 #22
0
ファイル: local.c プロジェクト: AkiraShirase/audacity
void localinit(void)
{
    falloc_init();
/*    probe_init(true);*/
    sound_init();
#ifdef CMTSTUFF
    seqext_init();
#endif
    sine_init();
    stk_init();
}
コード例 #23
0
ファイル: vsid.c プロジェクト: aerdnar/emu-ex-plus-alpha
/* C64-specific initialization.  */
int machine_specific_init(void)
{
#if defined(USE_SDLUI) || defined(USE_SDLUI2)
    if (console_mode) {
        video_disabled_mode = 1;
    }
#else
    video_disabled_mode = 1;
#endif

    c64_log = log_open("C64");

    if (mem_load() < 0) {
        return -1;
    }

    if (vicii_init(VICII_STANDARD) == NULL && !video_disabled_mode) {
        return -1;
    }

    c64_mem_init();

    cia1_init(machine_context.cia1);
    cia2_init(machine_context.cia2);

    c64_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec, machine_timing.cycles_per_sec);

    /* Initialize native sound chip */
    sid_sound_chip_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.rfsh_per_sec * machine_timing.cycles_per_rfsh));

    /* Initialize the C64-specific part of the UI.  */
    if (!console_mode) {
        vsid_ui_init();
    }

    /* Initialize glue logic.  */
    c64_glue_init();

    machine_drive_stub();

    return 0;
}
コード例 #24
0
ファイル: sound.c プロジェクト: 0s4l/u-boot-xlnx
/* Initilaise sound subsystem */
static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
	int ret;

	ret = sound_init(gd->fdt_blob);
	if (ret) {
		printf("Initialise Audio driver failed\n");
		return CMD_RET_FAILURE;
	}

	return 0;
}
コード例 #25
0
ファイル: sound.c プロジェクト: BackupTheBerlios/bimmerbox
void sound_playback_thread(void)
{
    /* To get smooth playback, two buffers are needed, which are queued for
     * playback. (There can still be glitches though.)
     */
    HWAVEOUT wave_out;
    WAVEHDR header1;
    WAVEHDR header2;
    HANDLE event;
    int result = -1;

    if ((event = CreateEvent(NULL, FALSE, FALSE, NULL)))
    {
        result = sound_init(&wave_out, event);
    }
    
    while(-1 == result || !event)
    {
        Sleep(100000); /* Wait forever, can't play sound! */
    }
    
    while (true)
    {
        while (!sound_get_pcm)
        {
            /* TODO: fix a fine thread-synch mechanism here */
            Sleep(100);
        }

        DEBUGF("starting simulator playback\n");
        header1.dwFlags = WHDR_DONE;
        header2.dwFlags = WHDR_DONE;
        sound_play_chunk(wave_out, &header1, event);
        sound_play_chunk(wave_out, &header2, event);

        while (sound_get_pcm 
            && (WAIT_FAILED != WaitForSingleObject(event, 1000)))
        {
            sound_play_chunk(wave_out, &header1, event);
            sound_play_chunk(wave_out, &header2, event);
        }
        
        pcm_play_stop();
        
        DEBUGF("stopping simulator playback\n");

        waveOutReset(wave_out);
    }
}
コード例 #26
0
static int
machine_select_machine( fuse_machine_info *machine )
{
  int width, height;
  int capabilities;

  machine_current = machine;

  settings_set_string( &settings_current.start_machine, machine->id );
  
  tstates = 0;

  /* Reset the event stack */
  event_reset();
  event_add( 0, timer_event );
  event_add( machine->timings.tstates_per_frame, spectrum_frame_event );

  sound_end();

  if( uidisplay_end() ) return 1;

  capabilities = libspectrum_machine_capabilities( machine->machine );

  /* Set screen sizes here */
  if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_VIDEO ) {
    width = DISPLAY_SCREEN_WIDTH;
    height = 2*DISPLAY_SCREEN_HEIGHT;
  } else {
    width = DISPLAY_ASPECT_WIDTH;
    height = DISPLAY_SCREEN_HEIGHT;
  }

  if( uidisplay_init( width, height ) ) return 1;

  sound_init( settings_current.sound_device );

  /* Do a hard reset */
  if( machine_reset( 1 ) ) return 1;

  /* And the dock menu item */
  if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_TIMEX_DOCK ) {
    ui_menu_activate( UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT, 0 );
  }

  /* Reset any dialogue boxes etc. which contain machine-dependent state */
  ui_widgets_reset();

  return 0;
}
コード例 #27
0
ファイル: core.c プロジェクト: timsjostrand/lodge
/**
 * @param load_callback		Responsible for registering all the VFS callbacks
 *							required for the game. After load_callback has been
 *							run, assets are immediately loaded.
 * @param init_callback		Runs after assets are loaded, and should set up game
 *							objects to their initial state.
 * @param release_callback	Runs just before the game quits, and should release
 *							all assets and free dynamically allocated memory.
 */
void core_setup(const char *title, float view_width, float view_height,
		int window_width, int window_height, int window_mode, size_t game_memory_size)
{
	lodge_window_initialize();

	/* Store global references. */
	core_global->view_width = view_width;
	core_global->view_height = view_height;

	/* Set up sound */
	sound_init(&core_global->sound, (float *)core_global->sound_listener, core_global->sound_distance_max);

	/* Allocate game memory */
	core_global->shared_memory.game_memory = malloc(game_memory_size);
	core_global->shared_memory.core = core_global;
	core_global->shared_memory.sound = &core_global->sound;
	core_global->shared_memory.assets = assets;
	core_global->shared_memory.vfs = vfs_global;
	core_global->shared_memory.input = &core_global->input;
	core_global->init_memory_callback(&core_global->shared_memory, 0);

	/* Seed random number generator. */
	srand(time(NULL));

	/* Set up window. */
	core_global->graphics.view_width = view_width;
	core_global->graphics.view_height = view_height;
	core_global->graphics.window = lodge_window_create(title, window_width, window_height, window_mode, &core_window_create);

	if (!core_global->graphics.window) {
		core_error("Could not create window\n");
		return;
	}

	/* Setup input. */
	int ret = input_init(&core_global->input, core_global->graphics.window, &core_key_callback, &core_char_callback, &core_mousebutton_callback);

	if (ret != GRAPHICS_OK) {
		core_error("Input initialization failed (%d)\n", ret);
		graphics_free(&core_global->graphics);
		exit(ret);
	}

	lodge_window_set_resize_callback(core_global->graphics.window, &core_resize_callback);

	/* Load all assets */
	core_load();
}
コード例 #28
0
ファイル: openphone.c プロジェクト: dhs-shine/sprd_project
int board_init()
{
	gd->bd->bi_arch_number = MACH_TYPE_OPENPHONE;
	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
#if 0
    ADI_init();
    chip_init();
    LDO_Init();
    sprd_gpio_init();
    //board_gpio_init();
#endif	
	pin_init();
	sprd_gpio_init(sprd_gpio_resource);
	sound_init();

	return 0;
}
コード例 #29
0
ファイル: openphone.c プロジェクト: dhs-shine/sprd_project
int board_init()
{
    gd->bd->bi_arch_number = MACH_TYPE_OPENPHONE;
    gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
    misc_init();
    ADI_init();
    LDO_Init();
    ADC_Init();
    pin_init();
    sprd_eic_init();
    sprd_gpio_init();
    sound_init();

    TDPllRefConfig(1);

    return 0;
}
コード例 #30
0
ファイル: openphone.c プロジェクト: dhs-shine/sprd_project
int board_init()
{
	gd->bd->bi_arch_number = MACH_TYPE_OPENPHONE;
	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
	ADI_init();
	misc_init();
	LDO_Init();
	ADC_Init();
	pin_init();
	sprd_eic_init();
	sprd_gpio_init();
	sound_init();
	init_ldo_sleep_gr();
	//cp2_rfctl_init();

	return 0;
}