void CPU_Init() { coreState = CORE_POWERUP; currentCPU = &mipsr4k; numCPUs = 1; // Default memory settings // Seems to be the safest place currently.. if (g_Config.iPSPModel == PSP_MODEL_FAT) Memory::g_MemorySize = Memory::RAM_NORMAL_SIZE; // 32 MB of ram by default else Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE; g_RemasterMode = false; g_DoubleTextureCoordinates = false; Memory::g_PSPModel = g_Config.iPSPModel; std::string filename = coreParameter.fileToStart; IdentifiedFileType type = Identify_File(filename); switch (type) { case FILETYPE_PSP_ISO: case FILETYPE_PSP_ISO_NP: case FILETYPE_PSP_DISC_DIRECTORY: InitMemoryForGameISO(filename); break; default: break; } Memory::Init(); mipsr4k.Reset(); host->AttemptLoadSymbolMap(); if (coreParameter.enableSound) { Audio_Init(); } CoreTiming::Init(); // Init all the HLE modules HLEInit(); // TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly // Why did we check for CORE_POWERDOWN here? if (!LoadFile(filename, &coreParameter.errorString)) { CPU_Shutdown(); coreParameter.fileToStart = ""; CPU_SetState(CPU_THREAD_NOT_RUNNING); return; } if (coreParameter.updateRecent) { g_Config.AddRecent(filename); } coreState = coreParameter.startPaused ? CORE_STEPPING : CORE_RUNNING; }
/* Open the audio device */ static int open_output(void) { int i; if((i = Audio_Init()) != 0) return i; if((i = Audio_On()) != 0) return i; dpm.fd = 0; return 0; }
void Sound_setup(void) { printf("[sound] initializing sound\n"); Audio_Init(); Sound_loadFX(); Sound_setFxVolume(getSettingf("fxVolume")); Sound_reloadTrack(); Sound_setMusicVolume(getSettingf("musicVolume")); Audio_Start(); }
/** * Shortcut to sound on/off */ static void ShortCut_SoundOnOff(void) { /* Toggle sound on/off */ ConfigureParams.Sound.bEnableSound ^= true; /* And start/stop if need to */ if (!ConfigureParams.Sound.bEnableSound) { if (Sound_AreWeRecording()) Sound_EndRecording(); Audio_UnInit(); } else { Audio_Init(); } }
/******************************************************************************* * Function Name : main * Description : Main program. * Input : None * Output : None * Return : None *******************************************************************************/ int main(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); //FSMC config GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_ResetBits(GPIOD , GPIO_Pin_7); //CS=0; LCD_Initializtion(); NVIC_Configuration();/* Interrupt Config (SD/usart) */ USART_Configuration(); GET_SYSclock(); //Prepare for audio processing (nothing special) Audio_Init(); //SETUP I2S2/I2S3 TX/RX GPIO pins and configure i2s2/i2s3 Codec_Init(48000); //setup codec settings via i2c to the uda1380 chip UDA1380_Configuration(); //Setup the DMA/interrupts for I2s2 and I2s3 I2S_Block_Init(); //begin audio processing/playback I2S_Block_PlayRec((uint32_t)&tx_buffer, (uint32_t)&rx_buffer, BUFF_LEN); while (1) {} }
int main( int argc, char **argv ) { MemStartCheck(); { char* test = new char[16]; delete [] test; } SDL_Surface *surface = 0; // SDL initialization steps. if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK ) < 0 ) { fprintf( stderr, "SDL initialization failed: %s\n", SDL_GetError( ) ); exit( 1 ); } SDL_EnableKeyRepeat( 0, 0 ); SDL_EnableUNICODE( 1 ); const SDL_version* sversion = SDL_Linked_Version(); GLOUTPUT(( "SDL: major %d minor %d patch %d\n", sversion->major, sversion->minor, sversion->patch )); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8); if ( multisample ) { SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, multisample ); } int videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */ videoFlags |= SDL_GL_DOUBLEBUFFER; /* Enable double buffering */ if ( fullscreen ) videoFlags |= SDL_FULLSCREEN; else videoFlags |= SDL_RESIZABLE; #ifdef TEST_ROTATION screenWidth = SCREEN_WIDTH; screenHeight = SCREEN_HEIGHT; #else screenWidth = SCREEN_HEIGHT; screenHeight = SCREEN_WIDTH; #endif if ( argc == 3 ) { screenWidth = atoi( argv[1] ); screenHeight = atoi( argv[2] ); if ( screenWidth <= 0 ) screenWidth = IPOD_SCREEN_WIDTH; if ( screenHeight <= 0 ) screenHeight = IPOD_SCREEN_HEIGHT; } // Note that our output surface is rotated from the iPod. //surface = SDL_SetVideoMode( IPOD_SCREEN_HEIGHT, IPOD_SCREEN_WIDTH, 32, videoFlags ); surface = SDL_SetVideoMode( screenWidth, screenHeight, 32, videoFlags ); GLASSERT( surface ); int stencil = 0; int depth = 0; SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &stencil ); glGetIntegerv( GL_DEPTH_BITS, &depth ); GLOUTPUT(( "SDL surface created. w=%d h=%d bpp=%d stencil=%d depthBits=%d\n", surface->w, surface->h, surface->format->BitsPerPixel, stencil, depth )); /* Verify there is a surface */ if ( !surface ) { fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) ); exit( 1 ); } SDL_JoystickEventState(SDL_ENABLE); SDL_Joystick* joystick = SDL_JoystickOpen(0); if ( joystick ) { GLOUTPUT(( "Joystick '%s' open.\n", SDL_JoystickName(0) )); } int r = glewInit(); GLASSERT( r == GL_NO_ERROR ); // Calling this seems to confuse my ATI driver and cause lag / event back up? //#ifdef TEST_FULLSPEED // wglSwapIntervalEXT( 0 ); // vsync //#else // wglSwapIntervalEXT( 1 ); // vsync //#endif const unsigned char* vendor = glGetString( GL_VENDOR ); const unsigned char* renderer = glGetString( GL_RENDERER ); const unsigned char* version = glGetString( GL_VERSION ); GLOUTPUT(( "OpenGL vendor: '%s' Renderer: '%s' Version: '%s'\n", vendor, renderer, version )); Audio_Init(); bool done = false; bool zooming = false; SDL_Event event; float yRotation = 45.0f; grinliz::Vector2I mouseDown = { 0, 0 }; grinliz::Vector2I prevMouseDown = { 0, 0 }; U32 prevMouseDownTime = 0; int zoomX = 0; int zoomY = 0; void* game = 0; bool mapMakerMode = false; WIN32_FIND_DATA findFileData; HANDLE h; h = FindFirstFile( ".\\mods\\*.xwdb", &findFileData ); if ( h != INVALID_HANDLE_VALUE ) { BOOL findResult = TRUE; while( findResult && nModDB < GAME_MAX_MOD_DATABASES ) { grinliz::GLString* str = new grinliz::GLString( ".\\mods\\" ); str->append( findFileData.cFileName ); databases[nModDB++] = str; GameAddDatabase( str->c_str() ); findResult = FindNextFile( h, &findFileData ); } FindClose( h ); } if ( argc > 3 ) { // -- MapMaker -- // Engine::mapMakerMode = true; TileSetDesc desc; desc.set = "FARM"; desc.size = 16; desc.type = "TILE"; desc.variation = 0; if ( argc > 2 ) { desc.set = argv[2]; GLASSERT( strlen( desc.set ) == 4 ); } if ( argc > 3 ) { desc.size = atol( argv[3] ); GLASSERT( desc.size == 16 || desc.size == 32 || desc.size == 48 || desc.size == 64 ); } if ( argc > 4 ) { desc.type = argv[4]; GLASSERT( strlen( desc.type ) == 4 ); } if ( argc > 5 ) { desc.variation = atol( argv[5] ); GLASSERT( desc.variation >= 0 && desc.variation < 100 ); } game = new Game( screenWidth, screenHeight, rotation, ".\\resin\\", desc ); mapMakerMode = true; } else { game = NewGame( screenWidth, screenHeight, rotation, ".\\", tvMode ); } #if SEND_CRASH_LOGS // Can't call this until after the game is created! if ( !SettingsManager::Instance()->GetSuppressCrashLog() ) { // Check for a "didn't crash" file. FILE* fp = fopen( "UFO_Running.txt", "r" ); if ( fp ) { fseek( fp, 0, SEEK_END ); long len = ftell( fp ); if ( len > 1 ) { // Wasn't deleted. PostCurrentGame(); } fclose( fp ); } } { FILE* fp = fopen( "UFO_Running.txt", "w" ); if ( fp ) { fprintf( fp, "Game running." ); fclose( fp ); } } #endif #ifndef TEST_FULLSPEED SDL_TimerID timerID = SDL_AddTimer( TIME_BETWEEN_FRAMES, TimerCallback, 0 ); #endif bool L2Down = false; bool R2Down = false; grinliz::Vector2F joystickAxis[2] = { 0, 0 }; // ---- Main Loop --- // #ifdef TEST_FULLSPEED while ( !done ) { if ( SDL_PollEvent( &event ) ) #else while ( !done && SDL_WaitEvent( &event ) ) #endif { // The user event shouldn't be duplicated...if there are 2, pull out the dupe. if ( event.type == SDL_USEREVENT ) { SDL_Event e; while( true ) { int n = SDL_PeepEvents( &e, 1, SDL_PEEKEVENT, SDL_ALLEVENTS ); if ( n == 1 && e.type == SDL_USEREVENT ) { SDL_PeepEvents( &e, 1, SDL_GETEVENT, SDL_ALLEVENTS ); } else { break; } } } switch( event.type ) { case SDL_VIDEORESIZE: screenWidth = event.resize.w; screenHeight = event.resize.h; surface = SDL_SetVideoMode( screenWidth, screenHeight, 32, videoFlags ); GameDeviceLoss( game ); GameResize( game, event.resize.w, event.resize.h, rotation ); break; /* A: 0 Triggers: axis=2 X: 2 Y: 3 B: 1 L1: 4 R1: 5 */ case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: //GLOUTPUT(( "Button %d.\n", event.jbutton.button )); switch( event.jbutton.button ) { case 0: GameJoyButton( game, GAME_JOY_BUTTON_DOWN, event.type == SDL_JOYBUTTONDOWN ); break; case 1: GameJoyButton( game, GAME_JOY_BUTTON_RIGHT, event.type == SDL_JOYBUTTONDOWN ); break; case 2: GameJoyButton( game, GAME_JOY_BUTTON_LEFT, event.type == SDL_JOYBUTTONDOWN ); break; case 3: GameJoyButton( game, GAME_JOY_BUTTON_UP, event.type == SDL_JOYBUTTONDOWN ); break; case 4: GameJoyButton( game, GAME_JOY_L1, event.type == SDL_JOYBUTTONDOWN ); break; case 5: GameJoyButton( game, GAME_JOY_R1, event.type == SDL_JOYBUTTONDOWN ); break; } break; case SDL_JOYAXISMOTION: //GLOUTPUT(( "Axis %d to %d.\n", event.jaxis.axis, event.jaxis.value )); // axis2, posL, negR if ( event.jaxis.axis == 2 ) { int value = event.jaxis.value; static const int T = 10*1000; if ( value > 10 ) { if ( !L2Down && value > T ) { L2Down = true; GameJoyButton( game, GAME_JOY_L2, true ); } else if ( L2Down && value < T ) { L2Down = false; GameJoyButton( game, GAME_JOY_L2, false ); } } else if ( value < -10 ) { if ( !R2Down && value < -T ) { R2Down = true; GameJoyButton( game, GAME_JOY_R2, true ); } else if ( R2Down && value > -T ) { R2Down = false; GameJoyButton( game, GAME_JOY_R2, false ); } } } else { int value = event.jaxis.value; double normal = (double)value/32768.0f; int axis = -1; int stick = -1; switch( event.jaxis.axis ) { case 0: axis=0; stick=0; break; case 1: axis=1; stick=0; normal *= -1.0; break; case 3: axis=1; stick=1; normal *= -1.0f; break; case 4: axis=0; stick=1; break; default: break; } if ( axis >= 0 && stick >= 0 ) { joystickAxis[stick].X(axis) = (float)normal; } } break; case SDL_JOYHATMOTION: GameJoyDPad( game, event.jhat.value ); break; case SDL_KEYDOWN: { SDLMod sdlMod = SDL_GetModState(); if ( mapMakerMode && event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9 ) { int index = 0; switch ( event.key.keysym.sym ) { case SDLK_1: index = 0; break; case SDLK_2: index = 1; break; case SDLK_3: index = 2; break; case SDLK_4: index = 3; break; case SDLK_5: index = 4; break; case SDLK_6: index = 5; break; case SDLK_7: index = 6; break; case SDLK_8: index = 7; break; case SDLK_9: index = 8; break; case SDLK_0: index = 9; break; }; const U8* light = ((Game*)game)->engine->GetMap()->DayTime() ? dayLight : nightLight; static const float INV = 1.0f/255.0f; U8 r = light[index*3+0]; U8 g = light[index*3+1]; U8 b = light[index*3+2]; if ( sdlMod & sdlMod & ( KMOD_LSHIFT | KMOD_RSHIFT ) ) { if ( index < 6 ) { // Average with shade. r = (light[index*3+0] + light[SHADE*3+0]) / 2; g = (light[index*3+1] + light[SHADE*3+1]) / 2; b = (light[index*3+2] + light[SHADE*3+2]) / 2; } else if ( index > 6 ) { // make darker (index 6 is the darkest. SHIFT does nothing.) int m = index-1; r = (light[index*3+0] + light[m*3+0]) / 2; g = (light[index*3+1] + light[m*3+1]) / 2; b = (light[index*3+2] + light[m*3+2]) / 2; } } ((Game*)game)->SetLightMap( (float)r * INV, (float)g * INV, (float)b * INV ); } switch ( event.key.keysym.sym ) { case SDLK_ESCAPE: { //int handled = GameHotKey( game, GAME_HK_BACK ); #ifdef DEBUG // only escape out in debug mode // if ( !handled ) done = true; #endif } break; case SDLK_F4: if ( sdlMod & ( KMOD_RALT | KMOD_LALT ) ) done = true; break; #ifdef SIM_GAMEPAD case SDLK_RIGHT: GameJoyDPad( game, GAME_JOY_DPAD_RIGHT ); break; case SDLK_LEFT: GameJoyDPad( game, GAME_JOY_DPAD_LEFT ); break; case SDLK_UP: GameJoyDPad( game, GAME_JOY_DPAD_UP ); break; case SDLK_DOWN: GameJoyDPad( game, GAME_JOY_DPAD_DOWN ); break; case SDLK_1: GameJoyButton( game, 1, true ); break; case SDLK_2: GameJoyButton( game, 2, true ); break; case SDLK_3: GameJoyButton( game, 3, true ); break; case SDLK_4: GameJoyButton( game, 4, true ); break; #else case SDLK_RIGHT: if ( !mapMakerMode ) { if ( sdlMod & (KMOD_RCTRL|KMOD_LCTRL) ) GameHotKey( game, GAME_HK_ROTATE_CW ); else GameHotKey( game, GAME_HK_NEXT_UNIT ); } break; case SDLK_LEFT: if ( !mapMakerMode ) { if ( sdlMod & (KMOD_RCTRL|KMOD_LCTRL) ) GameHotKey( game, GAME_HK_ROTATE_CCW ); else GameHotKey( game, GAME_HK_PREV_UNIT ); } break; #endif case SDLK_u: if ( mapMakerMode ) { ((Game*)game)->engine->camera.SetTilt( -90.0f ); ((Game*)game)->engine->camera.SetPosWC( 8.f, 90.f, 8.f ); ((Game*)game)->engine->camera.SetYRotation( 0.0f ); } else { GameHotKey( game, GAME_HK_TOGGLE_ROTATION_UI | GAME_HK_TOGGLE_NEXT_UI ); } break; case SDLK_o: if ( mapMakerMode ) { cameraIso = !cameraIso; ((Game*)game)->engine->CameraIso( cameraIso, true, (float)((Game*)game)->engine->GetMap()->Width(), (float)((Game*)game)->engine->GetMap()->Height() ); } break; case SDLK_s: if ( mapMakerMode ) { ((Game*)game)->SuppressText( true ); } GameDoTick( game, SDL_GetTicks() ); SDL_GL_SwapBuffers(); if ( mapMakerMode ) { ((Game*)game)->SuppressText( false ); } ScreenCapture( "cap" ); break; case SDLK_l: if ( mapMakerMode ) { const Surface* lightmap = ((Game*)game)->engine->GetMap()->GetLightMap(); SaveLightMap( lightmap ); } break; case SDLK_d: GameHotKey( game, GAME_HK_TOGGLE_DEBUG_TEXT ); break; case SDLK_DELETE: if ( mapMakerMode ) ((Game*)game)->DeleteAtSelection(); break; case SDLK_KP9: if ( mapMakerMode ) ((Game*)game)->RotateSelection( -1 ); break; case SDLK_r: case SDLK_KP7: if ( mapMakerMode ) ((Game*)game)->RotateSelection( 1 ); break; case SDLK_KP8: if ( mapMakerMode ) ((Game*)game)->DeltaCurrentMapItem(16); break; case SDLK_KP5: if ( mapMakerMode ) ((Game*)game)->DeltaCurrentMapItem(-16); break; case SDLK_KP6: if ( mapMakerMode ) ((Game*)game)->DeltaCurrentMapItem(1); break; case SDLK_KP4: if ( mapMakerMode ) ((Game*)game)->DeltaCurrentMapItem(-1); break; case SDLK_p: //if ( mapMakerMode ) { int pathing = (((Game*)game)->ShowingPathing() + 1) % 3; ((Game*)game)->ShowPathing( pathing ); } break; case SDLK_t: if ( mapMakerMode ) ((Game*)game)->engine->GetMap()->SetDayTime( !((Game*)game)->engine->GetMap()->DayTime() ); break; case SDLK_v: ((Game*)game)->ToggleTV(); break; case SDLK_m: if ( mapMakerMode ) ((Game*)game)->engine->EnableMetadata( !((Game*)game)->engine->IsMetadataEnabled() ); break; default: break; } /* GLOUTPUT(( "fov=%.1f rot=%.1f h=%.1f\n", game->engine.fov, game->engine.camera.Tilt(), game->engine.camera.PosWC().y )); */ } break; #ifdef SIM_GAMEPAD case SDL_KEYUP: { switch ( event.key.keysym.sym ) { case SDLK_1: GameJoyButton( game, 1, false ); break; case SDLK_2: GameJoyButton( game, 2, false ); break; case SDLK_3: GameJoyButton( game, 3, false ); break; case SDLK_4: GameJoyButton( game, 4, false ); break; } } break; #endif case SDL_MOUSEBUTTONDOWN: { int x, y; TransformXY( event.button.x, event.button.y, &x, &y ); mouseDown.Set( event.button.x, event.button.y ); if ( event.button.button == 1 ) { GameTap( game, GAME_TAP_DOWN, x, y ); } else if ( event.button.button == 3 ) { GameTap( game, GAME_TAP_CANCEL, x, y ); zooming = true; //GameCameraRotate( game, GAME_ROTATE_START, 0.0f ); SDL_GetRelativeMouseState( &zoomX, &zoomY ); } } break; case SDL_MOUSEBUTTONUP: { int x, y; TransformXY( event.button.x, event.button.y, &x, &y ); if ( event.button.button == 3 ) { zooming = false; } if ( event.button.button == 1 ) { GameTap( game, GAME_TAP_UP, x, y ); } } break; case SDL_MOUSEMOTION: { SDL_GetRelativeMouseState( &zoomX, &zoomY ); int state = SDL_GetMouseState(NULL, NULL); int x, y; TransformXY( event.button.x, event.button.y, &x, &y ); if ( state & SDL_BUTTON(1) ) { GameTap( game, GAME_TAP_MOVE, x, y ); } else if ( zooming && (state & SDL_BUTTON(3)) ) { float deltaZoom = 0.01f * (float)zoomY; GameZoom( game, GAME_ZOOM_DISTANCE, deltaZoom ); GameCameraRotate( game, (float)(zoomX)*0.5f ); } else if ( ( ( state & SDL_BUTTON(1) ) == 0 ) ) { ((Game*)game)->MouseMove( x, y ); } } break; case SDL_QUIT: { done = true; } break; case SDL_USEREVENT: { glEnable( GL_DEPTH_TEST ); glDepthFunc( GL_LEQUAL ); for( int stick=0; stick<2; ++stick ) { if ( joystickAxis[stick].x || joystickAxis[stick].y ) { GameJoyStick( game, stick, joystickAxis[stick].x, joystickAxis[stick].y ); } } GameDoTick( game, SDL_GetTicks() ); SDL_GL_SwapBuffers(); int databaseID=0, size=0, offset=0; // FIXME: account for databaseID when looking up sound. while ( GamePopSound( game, &databaseID, &offset, &size ) ) { Audio_PlayWav( "./res/uforesource.db", offset, size ); } }; default: break; } #ifdef TEST_FULLSPEED } glEnable( GL_DEPTH_TEST ); glDepthFunc( GL_LEQUAL ); GameDoTick( game, SDL_GetTicks() ); SDL_GL_SwapBuffers(); } #else }
void CPU_Init() { coreState = CORE_POWERUP; currentMIPS = &mipsr4k; g_symbolMap = new SymbolMap(); // Default memory settings // Seems to be the safest place currently.. Memory::g_MemorySize = Memory::RAM_NORMAL_SIZE; // 32 MB of ram by default g_RemasterMode = false; g_DoubleTextureCoordinates = false; Memory::g_PSPModel = g_Config.iPSPModel; std::string filename = coreParameter.fileToStart; loadedFile = ResolveFileLoaderTarget(ConstructFileLoader(filename)); #ifdef _M_X64 if (g_Config.bCacheFullIsoInRam) { loadedFile = new RamCachingFileLoader(loadedFile); } #endif IdentifiedFileType type = Identify_File(loadedFile); // TODO: Put this somewhere better? if (coreParameter.mountIso != "") { coreParameter.mountIsoLoader = ConstructFileLoader(coreParameter.mountIso); } MIPSAnalyst::Reset(); Replacement_Init(); switch (type) { case FILETYPE_PSP_ISO: case FILETYPE_PSP_ISO_NP: case FILETYPE_PSP_DISC_DIRECTORY: InitMemoryForGameISO(loadedFile); break; case FILETYPE_PSP_PBP: InitMemoryForGamePBP(loadedFile); break; case FILETYPE_PSP_PBP_DIRECTORY: // This is normal for homebrew. // ERROR_LOG(LOADER, "PBP directory resolution failed."); break; default: break; } // Here we have read the PARAM.SFO, let's see if we need any compatibility overrides. // Homebrew usually has an empty discID, and even if they do have a disc id, it's not // likely to collide with any commercial ones. std::string discID = g_paramSFO.GetValueString("DISC_ID"); if (!discID.empty()) { coreParameter.compat.Load(discID); } Memory::Init(); mipsr4k.Reset(); host->AttemptLoadSymbolMap(); if (coreParameter.enableSound) { Audio_Init(); } CoreTiming::Init(); // Init all the HLE modules HLEInit(); // TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly // Why did we check for CORE_POWERDOWN here? if (!LoadFile(&loadedFile, &coreParameter.errorString)) { CPU_Shutdown(); coreParameter.fileToStart = ""; CPU_SetState(CPU_THREAD_NOT_RUNNING); return; } if (coreParameter.updateRecent) { g_Config.AddRecent(filename); } coreState = coreParameter.startPaused ? CORE_STEPPING : CORE_RUNNING; }
extern "C" int Alynx_Init(char* rom, char* bios) { StartTicks(); mpLynx = new CSystem(rom, bios); if( !Video_Setup(LynxScale) ) return 0; if(gAudioEnabled) { if(Audio_Init()) { gAudioEnabled = TRUE; } } Video_Init(); start_time = GetTicks(); KeyMask = mpLynx->GetButtonData(); a_printf("Starting Lynx Emulation...\n"); emulation=0; pause=0; while(!emulation) { mpLynx->SetButtonData(KeyMask); // Update TimerCount gTimerCount++; while( Alynx_Update() ) { if(!gSystemHalt) { for(ULONG loop=1024;loop;loop--) mpLynx->Update(); } else gTimerCount++; } if(gAudioEnabled) Audio_CallBack(); this_time = GetTicks(); fps_counter = (((float)gTimerCount/(this_time-start_time))*1000.0); if( (Throttle) && (fps_counter > 59.99) ) Delay( (Uint32)fps_counter ); native_fps = static_cast<int>(fps_counter); while(pause==1) { Delay(20); } } free(mpLynxBuffer); free(HandyBuffer); free(mainSurface); start_render=0; delete mpLynx; a_printf("Stoping...\n"); return 0; }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; std::string fn; switch (message) { case WM_CREATE: break; case WM_MOVE: SavePosition(); ResizeDisplay(); break; case WM_SIZE: SavePosition(); ResizeDisplay(); break; case WM_TIMER: // Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode. switch (wParam) { case TIMER_CURSORUPDATE: CorrectCursor(); return 0; case TIMER_CURSORMOVEUPDATE: hideCursor = true; KillTimer(hWnd, TIMER_CURSORMOVEUPDATE); return 0; } break; // For some reason, need to catch this here rather than in DisplayProc. case WM_MOUSEWHEEL: { int wheelDelta = (short)(wParam >> 16); KeyInput key; key.deviceId = DEVICE_ID_MOUSE; if (wheelDelta < 0) { key.keyCode = NKCODE_EXT_MOUSEWHEEL_DOWN; wheelDelta = -wheelDelta; } else { key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP; } // There's no separate keyup event for mousewheel events, let's pass them both together. // This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something. key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16); NativeKey(key); } break; case WM_COMMAND: { if (!EmuThread_Ready()) return DefWindowProc(hWnd, message, wParam, lParam); I18NCategory *g = GetI18NCategory("Graphics"); wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case ID_FILE_LOAD: BrowseAndBoot(""); break; case ID_FILE_LOAD_DIR: BrowseAndBoot("",true); break; case ID_FILE_LOAD_MEMSTICK: { std::string memStickDir, flash0dir; GetSysDirectories(memStickDir, flash0dir); memStickDir += "PSP\\GAME\\"; BrowseAndBoot(memStickDir); } break; case ID_FILE_MEMSTICK: { std::string memStickDir, flash0dir; GetSysDirectories(memStickDir, flash0dir); ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW); } break; case ID_TOGGLE_PAUSE: if (globalUIState == UISTATE_PAUSEMENU) { NativeMessageReceived("run", ""); if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0); } else if (Core_IsStepping()) { // It is paused, then continue to run. if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0); else Core_EnableStepping(false); } else { if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0); else Core_EnableStepping(true); } break; case ID_EMULATION_STOP: if (memoryWindow[0]) { SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); } if (disasmWindow[0]) { SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); } if (Core_IsStepping()) { Core_EnableStepping(false); } NativeMessageReceived("stop", ""); SetPlaying(0); Update(); break; case ID_EMULATION_RESET: NativeMessageReceived("reset", ""); break; case ID_EMULATION_SPEEDLIMIT: g_Config.bSpeedLimit = !g_Config.bSpeedLimit; break; case ID_EMULATION_RENDER_MODE_OGL: g_Config.bSoftwareRendering = false; break; case ID_EMULATION_RENDER_MODE_SOFT: g_Config.bSoftwareRendering = true; break; case ID_FILE_LOADSTATEFILE: if (W32Util::BrowseForFileName(true, hWnd, "Load state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) { SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::Load(fn, SaveStateActionFinished); } break; case ID_FILE_SAVESTATEFILE: if (W32Util::BrowseForFileName(false, hWnd, "Save state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) { SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::Save(fn, SaveStateActionFinished); } break; // TODO: Improve UI for multiple slots case ID_FILE_SAVESTATE_NEXT_SLOT: { currentSavestateSlot = (currentSavestateSlot + 1)%SaveState::SAVESTATESLOTS; char msg[30]; sprintf(msg, "Using save state slot %d.", currentSavestateSlot + 1); osm.Show(msg); break; } case ID_FILE_QUICKLOADSTATE: SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::LoadSlot(currentSavestateSlot, SaveStateActionFinished); break; case ID_FILE_QUICKSAVESTATE: SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::SaveSlot(currentSavestateSlot, SaveStateActionFinished); break; case ID_OPTIONS_SCREEN1X: setZoom(ZOOM_NATIVE); break; case ID_OPTIONS_SCREEN2X: setZoom(ZOOM_2X); break; case ID_OPTIONS_SCREEN3X: setZoom(ZOOM_3X); break; case ID_OPTIONS_SCREEN4X: setZoom(ZOOM_MAX); break; case ID_OPTIONS_SCREENDUMMY: g_Config.iWindowZoom = ++g_Config.iWindowZoom > ZOOM_MAX ? ZOOM_NATIVE : g_Config.iWindowZoom; setZoom(g_Config.iWindowZoom); break; case ID_OPTIONS_MIPMAP: g_Config.bMipMap = !g_Config.bMipMap; break; case ID_OPTIONS_VSYNC: g_Config.bVSync = !g_Config.bVSync; break; case ID_TEXTURESCALING_OFF: setTexScalingMultiplier(TEXSCALING_OFF); break; case ID_TEXTURESCALING_2X: setTexScalingMultiplier(TEXSCALING_2X); break; case ID_TEXTURESCALING_3X: setTexScalingMultiplier(TEXSCALING_3X); break; case ID_TEXTURESCALING_4X: setTexScalingMultiplier(TEXSCALING_4X); break; case ID_TEXTURESCALING_5X: setTexScalingMultiplier(TEXSCALING_MAX); break; case ID_TEXTURESCALING_XBRZ: setTexScalingType(TextureScaler::XBRZ); break; case ID_TEXTURESCALING_HYBRID: setTexScalingType(TextureScaler::HYBRID); break; case ID_TEXTURESCALING_BICUBIC: setTexScalingType(TextureScaler::BICUBIC); break; case ID_TEXTURESCALING_HYBRID_BICUBIC: setTexScalingType(TextureScaler::HYBRID_BICUBIC); break; case ID_TEXTURESCALING_DEPOSTERIZE: g_Config.bTexDeposterize = !g_Config.bTexDeposterize; if(gpu) gpu->ClearCacheNextFrame(); break; case ID_OPTIONS_NONBUFFEREDRENDERING: setRenderingMode(FB_NON_BUFFERED_MODE); break; case ID_OPTIONS_BUFFEREDRENDERING: setRenderingMode(FB_BUFFERED_MODE); break; case ID_OPTIONS_READFBOTOMEMORYCPU: setRenderingMode(FB_READFBOMEMORY_CPU); break; case ID_OPTIONS_READFBOTOMEMORYGPU: setRenderingMode(FB_READFBOMEMORY_GPU); break; // Dummy option to let the buffered rendering hotkey cycle through all the options. case ID_OPTIONS_BUFFEREDRENDERINGDUMMY: g_Config.iRenderingMode = ++g_Config.iRenderingMode > FB_READFBOMEMORY_GPU ? FB_NON_BUFFERED_MODE : g_Config.iRenderingMode; setRenderingMode(g_Config.iRenderingMode); break; case ID_OPTIONS_SHOWDEBUGSTATISTICS: g_Config.bShowDebugStats = !g_Config.bShowDebugStats; break; case ID_OPTIONS_HARDWARETRANSFORM: g_Config.bHardwareTransform = !g_Config.bHardwareTransform; osm.ShowOnOff(g->T("Hardware Transform"), g_Config.bHardwareTransform); break; case ID_OPTIONS_STRETCHDISPLAY: g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay; if (gpu) gpu->Resized(); // Easy way to force a clear... break; case ID_OPTIONS_FRAMESKIP_0: setFrameSkipping(FRAMESKIP_OFF); break; case ID_OPTIONS_FRAMESKIP_1: setFrameSkipping(FRAMESKIP_1); break; case ID_OPTIONS_FRAMESKIP_2: setFrameSkipping(FRAMESKIP_2); break; case ID_OPTIONS_FRAMESKIP_3: setFrameSkipping(FRAMESKIP_3); break; case ID_OPTIONS_FRAMESKIP_4: setFrameSkipping(FRAMESKIP_4); break; case ID_OPTIONS_FRAMESKIP_5: setFrameSkipping(FRAMESKIP_5); break; case ID_OPTIONS_FRAMESKIP_6: setFrameSkipping(FRAMESKIP_6); break; case ID_OPTIONS_FRAMESKIP_7: setFrameSkipping(FRAMESKIP_7); break; case ID_OPTIONS_FRAMESKIP_8: setFrameSkipping(FRAMESKIP_8); break; case ID_OPTIONS_FRAMESKIP_9: setFrameSkipping(FRAMESKIP_MAX); break; case ID_OPTIONS_FRAMESKIPDUMMY: g_Config.iFrameSkip = ++g_Config.iFrameSkip > FRAMESKIP_MAX ? FRAMESKIP_OFF : g_Config.iFrameSkip; setFrameSkipping(g_Config.iFrameSkip); break; case ID_FILE_EXIT: DestroyWindow(hWnd); break; case ID_CPU_DYNAREC: g_Config.bJit = true; osm.ShowOnOff(g->T("Dynarec", "Dynarec (JIT)"), g_Config.bJit); break; case ID_CPU_INTERPRETER: g_Config.bJit = false; break; case ID_CPU_MULTITHREADED: g_Config.bSeparateCPUThread = !g_Config.bSeparateCPUThread; break; case ID_IO_MULTITHREADED: g_Config.bSeparateIOThread = !g_Config.bSeparateIOThread; break; case ID_EMULATION_RUNONLOAD: g_Config.bAutoRun = !g_Config.bAutoRun; break; case ID_DEBUG_DUMPNEXTFRAME: if (gpu) gpu->DumpNextFrame(); break; case ID_DEBUG_LOADMAPFILE: if (W32Util::BrowseForFileName(true, hWnd, "Load .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) { symbolMap.LoadSymbolMap(fn.c_str()); if (disasmWindow[0]) disasmWindow[0]->NotifyMapLoaded(); if (memoryWindow[0]) memoryWindow[0]->NotifyMapLoaded(); } break; case ID_DEBUG_SAVEMAPFILE: if (W32Util::BrowseForFileName(false, hWnd, "Save .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) symbolMap.SaveSymbolMap(fn.c_str()); break; case ID_DEBUG_RESETSYMBOLTABLE: symbolMap.ResetSymbolMap(); for (int i=0; i<numCPUs; i++) if (disasmWindow[i]) disasmWindow[i]->NotifyMapLoaded(); for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->NotifyMapLoaded(); break; case ID_DEBUG_DISASSEMBLY: if (disasmWindow[0]) disasmWindow[0]->Show(true); break; case ID_DEBUG_MEMORYVIEW: if (memoryWindow[0]) memoryWindow[0]->Show(true); break; case ID_DEBUG_LOG: LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); break; case ID_OPTIONS_IGNOREILLEGALREADS: g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; break; case ID_OPTIONS_FULLSCREEN: g_Config.bFullScreen = !g_Config.bFullScreen ; if(g_bFullScreen) { _ViewNormal(hWnd); } else { _ViewFullScreen(hWnd); } break; case ID_OPTIONS_VERTEXCACHE: g_Config.bVertexCache = !g_Config.bVertexCache; break; case ID_OPTIONS_SHOWFPS: g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; break; case ID_OPTIONS_FASTMEMORY: g_Config.bFastMemory = !g_Config.bFastMemory; break; case ID_OPTIONS_TEXTUREFILTERING_AUTO: setTexFiltering(AUTO); break; case ID_OPTIONS_NEARESTFILTERING: setTexFiltering(NEAREST); break; case ID_OPTIONS_LINEARFILTERING: setTexFiltering(LINEAR); break; case ID_OPTIONS_LINEARFILTERING_CG: setTexFiltering(LINEARFMV); break; case ID_OPTIONS_TOPMOST: g_Config.bTopMost = !g_Config.bTopMost; W32Util::MakeTopMost(hWnd, g_Config.bTopMost); break; case ID_OPTIONS_ANTIALIASING: g_Config.bAntiAliasing = !g_Config.bAntiAliasing; ResizeDisplay(true); break; case ID_OPTIONS_CONTROLS: MessageBox(hWnd, "Control mapping has been moved to the in-window Settings menu.\n", "Sorry", 0); break; case ID_EMULATION_SOUND: g_Config.bEnableSound = !g_Config.bEnableSound; if(!g_Config.bEnableSound) { EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED); if(!IsAudioInitialised()) Audio_Init(); } else { if(Atrac3plus_Decoder::IsInstalled()) EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED); } break; case ID_EMULATION_ATRAC3_SOUND: g_Config.bEnableAtrac3plus = !g_Config.bEnableAtrac3plus; if(Atrac3plus_Decoder::IsInstalled()) { if(g_Config.bEnableAtrac3plus) Atrac3plus_Decoder::Init(); else Atrac3plus_Decoder::Shutdown(); } else { EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED); } break; case ID_HELP_OPENWEBSITE: ShellExecute(NULL, "open", "http://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL); break; case ID_HELP_OPENFORUM: ShellExecute(NULL, "open", "http://forums.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL); break; case ID_HELP_ABOUT: DialogManager::EnableAll(FALSE); DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); DialogManager::EnableAll(TRUE); break; case ID_DEBUG_TAKESCREENSHOT: g_TakeScreenshot = true; break; default: MessageBox(hwndMain,"Unimplemented","Sorry",0); break; } } break; case WM_INPUT: { UINT dwSize; GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)); if (!rawInputBuffer) { rawInputBuffer = malloc(dwSize); rawInputBufferSize = dwSize; } if (dwSize > rawInputBufferSize) { rawInputBuffer = realloc(rawInputBuffer, dwSize); } GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBuffer, &dwSize, sizeof(RAWINPUTHEADER)); RAWINPUT* raw = (RAWINPUT*)rawInputBuffer; if (raw->header.dwType == RIM_TYPEKEYBOARD) { KeyInput key; key.deviceId = DEVICE_ID_KEYBOARD; if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) { key.flags = KEY_DOWN; key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)]; if (key.keyCode) { NativeKey(key); } } else if (raw->data.keyboard.Message == WM_KEYUP) { key.flags = KEY_UP; key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)]; if (key.keyCode) { NativeKey(key); } } } else if (raw->header.dwType == RIM_TYPEMOUSE) { mouseDeltaX += raw->data.mouse.lLastX; mouseDeltaY += raw->data.mouse.lLastY; // TODO : Smooth and translate to an axis every frame. // NativeAxis() } } return 0; case WM_DROPFILES: { if (!EmuThread_Ready()) return DefWindowProc(hWnd, message, wParam, lParam); HDROP hdrop = (HDROP)wParam; int count = DragQueryFile(hdrop,0xFFFFFFFF,0,0); if (count != 1) { MessageBox(hwndMain,"You can only load one file at a time","Error",MB_ICONINFORMATION); } else { TCHAR filename[512]; DragQueryFile(hdrop,0,filename,512); TCHAR *type = filename+_tcslen(filename)-3; SendMessage(hWnd, WM_COMMAND, ID_EMULATION_STOP, 0); // Ugly, need to wait for the stop message to process in the EmuThread. Sleep(20); MainWindow::SetPlaying(filename); MainWindow::Update(); NativeMessageReceived("boot", filename); } } break; case WM_CLOSE: EmuThread_Stop(); return DefWindowProc(hWnd,message,wParam,lParam); case WM_DESTROY: KillTimer(hWnd, TIMER_CURSORUPDATE); KillTimer(hWnd, TIMER_CURSORMOVEUPDATE); PostQuitMessage(0); break; case WM_USER+1: if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); if (memoryWindow[0]) SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS); DialogManager::AddDlg(disasmWindow[0]); disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad); if (g_Config.bFullScreen) _ViewFullScreen(hWnd); memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS); DialogManager::AddDlg(memoryWindow[0]); if (disasmWindow[0]) disasmWindow[0]->NotifyMapLoaded(); if (memoryWindow[0]) memoryWindow[0]->NotifyMapLoaded(); SetForegroundWindow(hwndMain); break; case WM_USER_SAVESTATE_FINISH: SetCursor(LoadCursor(0, IDC_ARROW)); break; case WM_USER_LOG_STATUS_CHANGED: if(!g_Config.bEnableLogging) { LogManager::GetInstance()->GetConsoleListener()->Show(false); EnableMenuItem(menu, ID_DEBUG_LOG, MF_GRAYED); } else { LogManager::GetInstance()->GetConsoleListener()->Show(true); EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED); } break; case WM_USER_ATRAC_STATUS_CHANGED: if(g_Config.bEnableAtrac3plus && Atrac3plus_Decoder::IsInstalled()) EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED); else EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED); break; case WM_MENUSELECT: // Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states // with corresponding menu items. UpdateMenus(); break; // Turn off the screensaver. // Note that if there's a screensaver password, this simple method // doesn't work on Vista or higher. case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: return 0; case SC_MONITORPOWER: return 0; } return DefWindowProc(hWnd, message, wParam, lParam); } default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
bool_t Context_Init(const tchar_t* Name,const tchar_t* Version,int Id,const tchar_t* CmdLine,void* Application) { context* p = malloc(sizeof(context)); if (!p) return 0; #ifdef PREALLOC { int i; for (i=0;i<PREALLOC;++i) q[i] = malloc(65536); } #endif memset(p,0,sizeof(context)); p->Version = CONTEXT_VERSION; p->ProgramId = Id; p->ProgramName = Name; p->ProgramVersion = Version; p->CmdLine = CmdLine; p->Lang = DefaultLang(); p->StartUpMemory = AvailMemory(); p->LowMemory = p->StartUpMemory < LOWMEMORY_LIMIT; p->Application = Application; SetContext(p); Mem_Init(); DynCode_Init(); String_Init(); PCM_Init(); Blit_Init(); Node_Init(); Platform_Init(); Stream_Init(); Advanced_Init(); Flow_Init(); Codec_Init(); Audio_Init(); Video_Init(); Format_Init(); Playlist_Init(); FormatBase_Init(); NullOutput_Init(); RawAudio_Init(); RawImage_Init(); Timer_Init(); IDCT_Init(); Overlay_Init(); M3U_Init(); PLS_Init(); ASX_Init(); WaveOut_Init(); SoftIDCT_Init(); #if defined(CONFIG_SUBS) SubTitle_Init(); #endif #if defined(TARGET_PALMOS) OverlayHIRES_Init(); //Win_Init(); //About_Init(); //BenchResult_Init(); //MediaInfo_Init(); //Settings_Init(); ASF_Init(); AVI_Init(); WAV_Init(); MP4_Init(); MPG_Init(); NSV_Init(); Law_Init(); ADPCM_Init(); #elif defined(TARGET_WIN32) || defined(TARGET_WINCE) #if defined(TARGET_WINCE) if (QueryPlatform(PLATFORM_TYPENO) != TYPE_SMARTPHONE) { OverlayRAW_Init(); OverlayGAPI_Init(); } else { OverlayGAPI_Init(); // prefer GAPI with smartphones (Sagem MyS-7 crashes with Raw FrameBuffer?) OverlayRAW_Init(); } OverlayDirect_Init(); OverlayS1D13806_Init(); #else OverlayConsole_Init(); #endif OverlayXScale_Init(); OverlayDDraw_Init(); // after GAPI and RAW and XScale OverlayFlyTV_Init(); OverlayGDI_Init(); #elif defined(TARGET_SYMBIAN) OverlaySymbian_Init(); #endif #ifdef NO_PLUGINS Static_Init(); #else Plugins_Init(); #endif Association_Init(); // after all formats are registered Color_Init(); Equalizer_Init(); Player_Init(); // after all output drivers are registered return 1; }