示例#1
0
void SetMode(int mode)
{
	if (mode==0x13)
		InitVideo(320, 240, 120, false);
	else
		InitVideo(640, 480, 120, false);
}
示例#2
0
static void
ParseDisplay (xmlDocPtr doc, xmlNodePtr node)
{
	xmlNodePtr dnode;
	xmlChar* value;
	int width=640,height=480;
	bool fullscreen=false;

	dnode = node->xmlChildrenNode;
	while (dnode != NULL)
	{
		value = xmlNodeListGetString (doc, dnode->xmlChildrenNode, 1);
		if (value != NULL)
		{
			if (!xmlStrcmp (dnode->name, (xmlChar*)"width"))
			{
				width = atoi ((char*)value);
			}
			else if (!xmlStrcmp (dnode->name, (xmlChar*)"height"))
			{
				height = atoi ((char*)value);
			}
			else if (!xmlStrcmp (dnode->name, (xmlChar*)"fullscreen"))
			{
				if (!xmlStrcasecmp (value, (xmlChar*)"true"))
					fullscreen=true;
			}
			xmlFree (value);


		}
		dnode = dnode->next;
	}
	InitVideo(width,height,fullscreen);
}
示例#3
0
文件: sdl.c 项目: BruceJawn/FlashNES
void ButtonConfigEnd(void)
{ 
 extern FCEUGI *CurGame;
 KillJoysticks();
 SDL_QuitSubSystem(SDL_INIT_VIDEO); 
 if(bcpv) InitVideo(CurGame);
 if(bcpj) InitJoysticks();
}
示例#4
0
EXPORT(void) ToggleFullScreen()
{
    int x, y, w, h;
    GetClippingRectangle(&x, &y, &w, &h);

    Config.fullscreen = !Config.fullscreen;

    bool succeeded = InitVideo(ScreenWidth, ScreenHeight);

    // if we failed, try to restore the original video mode
    if (!succeeded)
    {
        Config.fullscreen = !Config.fullscreen;
        InitVideo(ScreenWidth, ScreenHeight);
    }

    SetClippingRectangle(x, y, w, h);
}
示例#5
0
void Graphics::SetFullscreen(bool enable)
{
	if (is_fullscreen != enable)
	{
		is_fullscreen = enable;
		InitVideo();
		Graphics::FlushAll();
	}
}
示例#6
0
int main(int argc, char* argv[])
{
    SetSphereDirectory();

    // load the configuration settings, then save it for future reference
    SPHERECONFIG config;
    LoadSphereConfiguration(&config);

    for (int i = 0; i < 4; i++)
    {
        SetPlayerConfig(i,
                KeyStringToKeyCode(config.player_configurations[i].key_menu_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_up_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_down_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_left_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_right_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_a_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_b_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_x_str.c_str()),
                KeyStringToKeyCode(config.player_configurations[i].key_y_str.c_str()),
                config.player_configurations[i].keyboard_input_allowed,
                config.player_configurations[i].joypad_input_allowed);
    }

	SetGlobalConfig(config.language, config.sound, config.allow_networking);
    SaveSphereConfig(&config, (GetSphereDirectory() + "/engine.ini").c_str());

    // initialize screenshot directory
    std::string sphere_directory;
    char screenshot_directory[512];
    GetDirectory(sphere_directory);
    sprintf(screenshot_directory, "%s/screenshots", sphere_directory.c_str());
    SetScreenshotDirectory(screenshot_directory);

    // initialize video subsystem
    if (InitVideo(&config) == false)
    {
        printf("Video subsystem could not be initialized...\n");
        return 0;
    }

    // initialize input
    InitInput();

    // initialize audio
    if (!InitAudio(&config))
    {
        printf("Sound could not be initialized...\n");
    }

    atexit(CloseVideo);
    atexit(CloseAudio);

    RunSphere(argc, const_cast<const char **>(argv));

    return 0;
}
示例#7
0
文件: main.cpp 项目: ben401/OpenEmu
bool MT_FromRemote_VideoSync(void)
{
          KillVideo();

          memset(VTBuffer[0], 0, CurGame->pitch * 256);
          memset(VTBuffer[1], 0, CurGame->pitch * 256);

          if(!InitVideo(CurGame))
	   return(0);
	  return(1);
}
示例#8
0
文件: pymm.cpp 项目: ivan-chai/pymm
	void Init() {
	    if(Type == EFF_AUDIO_STREAM)
		InitAudio();
	    else if(Type == EFF_VIDEO_STREAM)
		InitVideo();
	    Frame = av_frame_alloc();
	    if(Frame == NULL)
		throw TFFmpegException("Couldn't allocate frame");
	    FrameSize = 0;
	    FrameOffs = 0;
	}
示例#9
0
文件: demo.cpp 项目: minus273/Ncard
int
main(int argc, char *argv[])
{
	InitVideo(); // Initialize video
	SetupPads(); // Initialize input
	//InitAudio(); // Initialize audio
	fatInitDefault(); // Initialize file system
	InitFreeType((u8*)font_ttf, font_ttf_size); // Initialize font system
	InitGUIThreads(); // Initialize GUI

	DefaultSettings();
	MainMenu(MENU_SETTINGS);
}
示例#10
0
文件: demux.c 项目: brendonjustin/vlc
int DemuxOpen( vlc_object_t *obj )
{
    demux_t *demux = (demux_t *)obj;

    demux_sys_t *sys = malloc (sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;
    demux->p_sys = sys;

    ParseMRL( obj, demux->psz_location );

    char *path = var_InheritString (obj, CFG_PREFIX"dev");
    if (unlikely(path == NULL))
        goto error; /* probably OOM */
    msg_Dbg (obj, "opening device '%s'", path);

    int rawfd = vlc_open (path, O_RDWR);
    if (rawfd == -1)
    {
        msg_Err (obj, "cannot open device '%s': %m", path);
        free (path);
        goto error;
    }
    free (path);

    int fd = v4l2_fd_open (rawfd, 0);
    if (fd == -1)
    {
        msg_Warn (obj, "cannot initialize user-space library: %m");
        /* fallback to direct kernel mode anyway */
        fd = rawfd;
    }
    sys->fd = fd;

    if (InitVideo (demux, fd))
    {
        v4l2_close (fd);
        goto error;
    }

    sys->controls = ControlsInit (VLC_OBJECT(demux), fd);
    demux->pf_demux = NULL;
    demux->pf_control = DemuxControl;
    demux->info.i_update = 0;
    demux->info.i_title = 0;
    demux->info.i_seekpoint = 0;
    return VLC_SUCCESS;
error:
    free (sys);
    return VLC_EGENERIC;
}
示例#11
0
文件: ntuser.c 项目: RPG-7/reactos
NTSTATUS
NTAPI
UserInitialize(VOID)
{
    static const DWORD wPattern55AA[] = /* 32 bit aligned */
    { 0x55555555, 0xaaaaaaaa, 0x55555555, 0xaaaaaaaa,
      0x55555555, 0xaaaaaaaa, 0x55555555, 0xaaaaaaaa };
    HBITMAP hPattern55AABitmap = NULL;
    NTSTATUS Status;

// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
// Create Event for Diconnect Desktop.

    Status = UserCreateWinstaDirectory();
    if (!NT_SUCCESS(Status)) return Status;

    /* Initialize Video */
    Status = InitVideo();
    if (!NT_SUCCESS(Status)) return Status;

// {
//     DrvInitConsole.
//     DrvChangeDisplaySettings.
//     Update Shared Device Caps.
//     Initialize User Screen.
// }
// Create ThreadInfo for this Thread!
// {

    /* Initialize the current thread */
    Status = InitThreadCallback(PsGetCurrentThread());
    if (!NT_SUCCESS(Status)) return Status;

// }
// Set Global SERVERINFO Error flags.
// Load Resources.

    NtUserUpdatePerUserSystemParameters(0, TRUE);

    if (gpsi->hbrGray == NULL)
    {
        hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA);
        gpsi->hbrGray = IntGdiCreatePatternBrush(hPattern55AABitmap);
        GreDeleteObject(hPattern55AABitmap);
        GreSetBrushOwner(gpsi->hbrGray, GDI_OBJ_HMGR_PUBLIC);
    }

    return STATUS_SUCCESS;
}
示例#12
0
static void DoCheatSeq(void)
{
#if defined(DOS) || defined(SDL) || defined(FLASH)
 SilenceSound(1);
#endif
 KillKeyboard();
 KillVideo();

 DoConsoleCheatConfig();
 InitVideo(CurGame);
 InitKeyboard();
#if defined(DOS) || defined(SDL) || defined(FLASH)
 SilenceSound(0);
#endif
}
示例#13
0
//---
void xmain(int argc, char *argv[])
{
	vc_initBuiltins();
	vc_initLibrary();

	InitGarlick();
	Handle::init();

	strcpy(mapname,"");

	LoadConfig();
	if (argc == 2)
	{
		if (strlen(argv[1]) > 254)
			err("Mapname argument too long!");
		strcpy(mapname, argv[1]);
	}

	InitVideo();

	mouse_Init();
	InitKeyboard();
	joy_Init();
	InitScriptEngine();

	gameWindow->setTitle(APPNAME);

	if (sound) snd_Init(soundengine);

	win_movie_init();
	ResetSprites();
	timer_Init(gamerate);

	LUA *lua;
	se = lua = new LUA();
	
	#ifdef ALLOW_SCRIPT_COMPILATION
	DisplayCompileImage();
	lua->compileSystem();
	CompileMaps("lua", lua);
	#endif
	
	se->ExecAutoexec();

	while (true && strlen(mapname))
		Engine_Start(mapname);
	err("");
}
示例#14
0
int main(int argc, char *argv[])
{
	xenon_make_it_faster(XENON_SPEED_FULL);
	InitVideo();
	
	usb_init();
	usb_do_poll();
	xenon_ata_init();
	
	xenon_sound_init();
	
	SetupPads();
	mount_all_devices();
	// Set defaults
	DefaultSettings(); 
	// Initialize font system
	InitFreeType((u8*)font_ttf, font_ttf_size); 
	
	browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY)*MAX_BROWSER_SIZE);
		
	while (1) // main loop
	{
		MainMenu(MENU_GAMESELECTION);
		EmuLaunch();
		
		if(EmuRunning)
			MainMenu(MENU_GAME);
		else
			MainMenu(MENU_GAMESELECTION);		

		if(EmuRunning)
			EmuResume();
		else
			EmuLaunch();
		
		if(EmuConfigRequested) {				
			EmuConfigRequested = 0;
			break;
		}
		if(EmuResetRequested) {
			EmuResetRequested = 0;
			EmuReset();
		}
	}
	
	return 0;
}
示例#15
0
// для GCC - другая
int main()
#endif
{
	MSG msg;
	WNDCLASSA wcl;
	// 0. Регистрируем оконный класс

	wcl.hInstance = NULL;
	wcl.lpszClassName = szWinName;
	wcl.lpfnWndProc = MyFunc;
	wcl.style = 0;
	wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcl.lpszMenuName = NULL;

	wcl.cbClsExtra = 0;
	wcl.cbWndExtra = 0;

	wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);

	if(!RegisterClassA(&wcl)) return 0;

	// 1. Создаём окно

	hWnd = CreateWindowA(szWinName, "Video", 
		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 700, HWND_DESKTOP, NULL, 
		NULL, NULL);

	// 2. Отображаем окно на экран
	ShowWindow(hWnd, SW_SHOW);
	UpdateWindow(hWnd);

	// 3. Запускаем таймер (20 мсек, 50 кадров в секунду)
	SetTimer(hWnd, 1, 20, NULL);

	// 4. стартуем получение кадров с камеры
	InitVideo();

	// 5. Стандартный цикл обработки событий
	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}
示例#16
0
文件: main.cpp 项目: Blizarre/ray
int main(int argc, char *argv[]) {
    Uint32 *screen; //This pointer will reference the backbuffer 
    screen = InitVideo(SCREEN_WIDTH, SCREEN_HEIGH);
    if (screen == nullptr) exit(SCREEN_INIT_ERROR);

    LightRay camera_ray(Position(0, 0, -3), Direction(0, 0, 1));
    World world;

    Sphere* mov = new Sphere(Position(3, 3, 10), 5, Material::glass());
    world.elements.push_back(mov);
    world.elements.push_back(new Sphere(Position(-3, 3, 10), 5, Material::RedPlastic()));
    world.elements.push_back(new Sphere(Position(-3, -3, 10), 4, Material::silver()));
    world.elements.push_back(new Plane());

    while (1) {

        SDL_Event event;
        while (SDL_PollEvent(&event)) {
            if (event.type == SDL_MOUSEMOTION) {
                world.globalLight.direction[0] += 0.01f * (event.motion.xrel);
                world.globalLight.direction[1] += 0.01f * (event.motion.yrel);
            }
            if (event.type == SDL_KEYDOWN) {
                exit(RETURN_OK);
            }
            if (event.type == SDL_QUIT) {
                exit(RETURN_OK);
            }
        }

        Uint32 t1 = SDL_GetTicks();
        mov->translate(Direction(0.f, 0.f, 0.1f * (1 - 2 * (((int) (t1 / 2000.0f)) % 2))));

        for (int x = 0; x < SCREEN_WIDTH; x++) for (int y = 0; y < SCREEN_HEIGH; y++) {
                screenPixelDirection(camera_ray.direction, static_cast<float> (x), static_cast<float> (y));
                Light value = world.rayTracing(camera_ray, nullptr);
                setPixelValue(screen, x, y, lightToPixel(value));
        }

        showImage(screen);
        printf("time: %1ums\n", SDL_GetTicks() - t1);
    }

    freeRenderer(screen);
    return RETURN_OK;
}
示例#17
0
文件: demux.c 项目: Mettbrot/vlc
int DemuxOpen( vlc_object_t *obj )
{
    demux_t *demux = (demux_t *)obj;

    demux_sys_t *sys = malloc (sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;
    demux->p_sys = sys;
#ifdef ZVBI_COMPILED
    sys->vbi = NULL;
#endif

    ParseMRL( obj, demux->psz_location );

    char *path = var_InheritString (obj, CFG_PREFIX"dev");
    if (unlikely(path == NULL))
        goto error; /* probably OOM */

    uint32_t caps;
    int fd = OpenDevice (obj, path, &caps);
    free (path);
    if (fd == -1)
        goto error;
    sys->fd = fd;

    if (InitVideo (demux, fd, caps))
    {
        v4l2_close (fd);
        goto error;
    }

    sys->controls = ControlsInit (VLC_OBJECT(demux), fd);
    sys->start = mdate ();
    demux->pf_demux = NULL;
    demux->pf_control = DemuxControl;
    demux->info.i_update = 0;
    demux->info.i_title = 0;
    demux->info.i_seekpoint = 0;
    return VLC_SUCCESS;
error:
    free (sys);
    return VLC_EGENERIC;
}
示例#18
0
文件: init.cpp 项目: N4u/WiiCraft
void Initialize(void) {
    fatInitDefault();
    DebugStart(true, "sd://WiiCraft.log");
    Debug("\n");
    Debug("\n");
    Debug("\n");
    Debug("-------------------[WiiCraft Debug Log]----------------------");
    InitVideo();
    Debug("InitVideo() Done");
    InitPad();
    Debug("InitPad() Done");
    initFPS();
    Debug("InitFPS() Done");
//	ASND_Init();
//	Debug("ASND_Init() Done");
//	MP3Player_Init();
//	Debug("MP3Player_Init Done");

}
示例#19
0
X11Renderer::X11Renderer(VideoParams *params, const char *title, int locX, int locY) :
	VideoRenderer(params),
	pThread(false),
	m_pTitle(title),
	m_LocX(locX),
	m_LocY(locY),
	m_TStat()
{
	CreateWindow();
	InitVideo();

	m_RgbBuf = new uint8_t[m_VPar.height * m_VPar.width * 4];

	for (int i = 0; i < FRAME_QUEUE_LEN; i++)
		m_pFrameQueueBufs[i] = new VideoData(m_VPar.FrameSize());

	m_pFrameQueue = new StaticSyncQueue<VideoData*>(m_pFrameQueueBufs, FRAME_QUEUE_LEN);
	Start(); // start the thread
}
示例#20
0
void PaintApp::Initialize()
{
   // HACK for ubuntu1024: https://github.com/DrMcCoy/xoreos/commit/9a6c84d5458256ac5a0ff7525055ef2d8761e683
   if (!XInitThreads()) {
      throw "Failed to initialize Xlib muti-threading support";
   }

   mCurrentVideoMode = VideoMode::OpenGL;
   mCurrentResolution = {640_px, 480_px};

   InitVideo();
   InitKinect("");
   SelectRenderer(); // Kinect has to be set up for this!

   mWindow = std::make_shared<kinex::Window>("paint");
   mKinectBg = std::make_shared<NuiBackground>(mKinect);
   mState = std::make_shared<PaintStatus>();

   print_commands();
}
示例#21
0
/**
 * Initialize all of the subsystem drivers: video, audio, and joystick.
 */
static int
DriverInitialize(FCEUGI *gi)
{
	if(InitVideo(gi) < 0) return 0;
	inited|=4;

	if(InitSound())
		inited|=1;

	if(InitJoysticks())
		inited|=2;

	int fourscore=0;
	g_config->getOption("SDL.FourScore", &fourscore);
	eoptions &= ~EO_FOURSCORE;
	if(fourscore)
		eoptions |= EO_FOURSCORE;

	InitInputInterface();
	return 1;
}
示例#22
0
/*****************************************************************************
 * Open: probe the decoder and return score
 *****************************************************************************
 * Tries to launch a decoder and return score so that the interface is able
 * to choose.
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    decoder_t *p_dec = (decoder_t*)p_this;

    /* create a mutex */
    var_Create( p_this->p_libvlc, "rm_mutex", VLC_VAR_MUTEX );

    switch ( p_dec->fmt_in.i_codec )
    {
    case VLC_CODEC_RV10: 
    case VLC_CODEC_RV20: 
    case VLC_CODEC_RV30:
    case VLC_CODEC_RV40: 
        p_dec->p_sys = NULL;
        p_dec->pf_decode_video = DecodeVideo;
        return InitVideo(p_dec);

    default:
        return VLC_EGENERIC;
    }
}
示例#23
0
void kexSystem::Main(int argc, char **argv) {
    this->argc = argc;
    this->argv = argv;

    f_stdout = freopen("stdout.txt", "wt", stdout);
    f_stderr = freopen("stderr.txt", "wt", stderr);

    SpawnInternalConsole();

    Init();

    cvarManager.Init();
    kexObject::Init();
    inputSystem->Init();
    inputKey.Init();
    fileSystem.Init();
    soundSystem.Init();
    server.Init();
    client.Init();

    cvarManager.InitCustomCvars();

    gameManager.InitGame();
    inputKey.InitActions();

    common.ReadConfigFile("config.cfg");
    common.ReadConfigFile("autoexec.cfg");

    InitVideo();

    renderBackend.Init();
    renderer.Init();
    fxManager.Init();
    guiManager.Init();

    common.Printf("Running kernel...\n");
    gameManager.SpawnGame();
    MainLoop();
}
示例#24
0
/* constructor and destructor */
CSDL_ApplicationBase::CSDL_ApplicationBase(long flags) {
    m_bIsRunning = true;
    m_pErrorBuffer = new char[256];
    m_bIsOpenGL = (flags & SDL_OPENGL) ? true : false;
    m_bIsFullscreen = false;
    m_PrimarySurface = NULL;
    ::atexit (::SDL_Quit);
    if(flags & SDL_INIT_VIDEO) {
        InitVideo();
    }

    if(flags & SDL_INIT_AUDIO) {
        InitAudio();
    }
    if(flags & SDL_OPENGL) {
//        InitOpenGL();
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ) ;
    }


    Uint32          colorkey;
    SDL_Surface     *image;
    image = SDL_LoadBMP("data/Orc.bmp");
    colorkey = SDL_MapRGB(image->format, 255, 0, 255);
    SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);
    SDL_WM_SetIcon(image,NULL);

    SetCaption("Loading...");

    SetVideoMode(800, 600, 32, ((m_bIsFullscreen) ? SDL_FULLSCREEN : 0) | ((m_bIsOpenGL) ? SDL_OPENGL : SDL_HWSURFACE|SDL_DOUBLEBUF));


    m_MouseCursorSurface = new CSDL_Surface("data/cursor.bmp");
//    m_MouseCursorSurface->SetColorKey(255, 0, 255, SDL_SRCCOLORKEY|SDL_RLEACCEL);

    FPS_Init();

} // constructor
示例#25
0
文件: access.c 项目: 0xheart0/vlc
int AccessOpen( vlc_object_t *obj )
{
    access_t *access = (access_t *)obj;

    access_InitFields( access );

    access_sys_t *sys = calloc (1, sizeof (*sys));
    if( unlikely(sys == NULL) )
        return VLC_ENOMEM;
    access->p_sys = sys;

    ParseMRL( obj, access->psz_location );

    char *path = var_InheritString (obj, CFG_PREFIX"dev");
    if (unlikely(path == NULL))
        goto error; /* probably OOM */

    uint32_t caps;
    int fd = OpenDevice (obj, path, &caps);
    free (path);
    if (fd == -1)
        goto error;
    sys->fd = fd;

    if (InitVideo (access, fd, caps))
    {
        v4l2_close (fd);
        goto error;
    }

    sys->controls = ControlsInit (VLC_OBJECT(access), fd);
    access->pf_seek = NULL;
    access->pf_control = AccessControl;
    return VLC_SUCCESS;
error:
    free (sys);
    return VLC_EGENERIC;
}
示例#26
0
int main(int argc, char *argv[])
{
	__exception_setreload(20);
	
#ifdef GDB_DEBUG
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif
	
	InitVideo();
	
	if(StartUpProcess::Run(argc, argv))
	{
		Application::Instance()->init();
		Application::Instance()->show();
		Application::Instance()->exec();
	}
	
	//! Return to the Wii system menu if not from HBC
	if(!IsFromHBC())
		SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);

	return 0;
}
示例#27
0
int main(int argc, char **argv)
{
	u32 cookie;
	FILE *exeFile = NULL;
	void *exeBuffer          = (void *)EXECUTABLE_MEM_ADDR;
	int exeSize              = 0;
	u32 exeEntryPointAddress = 0;
	entrypoint exeEntryPoint;
	
	/* int videomod */
	InitVideo();
	/* get imagedata */
	u8 * imgdata = GetImageData();
	/* fadein of image */
	for(int i = 0; i < 255; i = i+10)
	{
		if(i>255) i = 255;
		Background_Show(0, 0, 0, imgdata, 0, 1, 1, i);
		Menu_Render();
	}
	
	/* check devices */
	SDCard_Init();
	USBDevice_Init();
	
	char cfgpath[256];
	
	/* Open dol File and check exist */
	sprintf(cfgpath, PATH1);
	exeFile = fopen (cfgpath ,"rb");
	if (exeFile==NULL)
	{
		sprintf(cfgpath, PATH2);
		exeFile = fopen (cfgpath ,"rb");
	}
	if (exeFile==NULL)
	{
		sprintf(cfgpath, PATH3);
		exeFile = fopen (cfgpath ,"rb");
	}
	if (exeFile==NULL)
	{
		sprintf(cfgpath, PATH4);
		exeFile = fopen (cfgpath ,"rb");
	}
	
	if (PACK2)
	{
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH5);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH6);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH7);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH8);
			exeFile = fopen (cfgpath ,"rb");
		}
	}
	
	if (PACK3)
	{
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH9);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH10);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH11);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH12);
			exeFile = fopen (cfgpath ,"rb");
		}
	}
	
	if (PACK4)
	{
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH13);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH14);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH15);
			exeFile = fopen (cfgpath ,"rb");
		}
		if (exeFile==NULL)
		{
			sprintf(cfgpath, PATH16);
			exeFile = fopen (cfgpath ,"rb");
		}
	}
	
	// if nothing found exiting
	if (exeFile==NULL) {
           printf("\n\n\t\tCan't find DOL File...\n");
           Menu_Render();
           sleep(3);
           fclose (exeFile);
           SDCard_deInit();
           USBDevice_deInit();
           StopGX();
		SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
	}

	fseek (exeFile, 0, SEEK_END);
	exeSize = ftell(exeFile);
	fseek (exeFile, 0, SEEK_SET);

	if(fread (exeBuffer, 1, exeSize, exeFile) != (unsigned int) exeSize)
	{
		printf("\n\n\t\tCan't open DOL File...\n");
		Menu_Render();
        fclose (exeFile);
		sleep(3);
        SDCard_deInit();
        USBDevice_deInit();
        StopGX();
		SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
	}
	fclose (exeFile);

	/* load entry point */
	struct __argv args;
	bzero(&args, sizeof(args));
	args.argvMagic = ARGV_MAGIC;
	args.length = strlen(cfgpath) + 2;
	args.commandLine = (char*)malloc(args.length);
	if (!args.commandLine) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
	strcpy(args.commandLine, cfgpath);
	args.commandLine[args.length - 1] = '\0';
	args.argc = 1;
	args.argv = &args.commandLine;
	args.endARGV = args.argv + 1;

	int ret = valid_elf_image(exeBuffer);
	if (ret == 1)
		exeEntryPointAddress = load_elf_image(exeBuffer);
	else
		exeEntryPointAddress = load_dol_image(exeBuffer, &args);

	/* fadeout of image */
	for(int i = 255; i > 1; i = i-7)
	{
		if(i < 0) i = 0;
		Background_Show(0, 0, 0, imgdata, 0, 1, 1, i);
		Menu_Render();
	}
	SDCard_deInit();
	USBDevice_deInit();
	StopGX();
	if (exeEntryPointAddress == 0) {
		printf("EntryPointAddress  failed...\n");
        Menu_Render();
        sleep(3);
        fclose (exeFile);
        SDCard_deInit();
        USBDevice_deInit();
        StopGX();
		SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);;
	}
	exeEntryPoint = (entrypoint) exeEntryPointAddress;
	/* cleaning up and load dol */
	SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
	_CPU_ISR_Disable (cookie);
	__exception_closeall ();
	exeEntryPoint ();
	_CPU_ISR_Restore (cookie);
	return 0;
}
示例#28
0
/**
**  The main program: initialise, parse options and arguments.
**
**  @param argc  Number of arguments.
**  @param argv  Vector of arguments.
*/
int main(int argc, char **argv)
{
#ifdef REDIRECT_OUTPUT
	RedirectOutput();
#endif

#ifdef USE_BEOS
	//  Parse arguments for BeOS
	beos_init(argc, argv);
#endif

	//  Setup some defaults.
#ifndef MAC_BUNDLE
	StratagusLibPath = ".";
#else
	freopen("/tmp/stdout.txt", "w", stdout);
	freopen("/tmp/stderr.txt", "w", stderr);
	// Look for the specified data set inside the application bundle
	// This should be a subdir of the Resources directory
	CFURLRef pluginRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
												 CFSTR(MAC_BUNDLE_DATADIR), NULL, NULL);
	CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,  kCFURLPOSIXPathStyle);
	const char *pathPtr = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());
	Assert(pathPtr);
	StratagusLibPath = pathPtr;
#endif

	Parameters &parameters = Parameters::Instance;
	parameters.SetDefaultValues();
	parameters.LocalPlayerName = GetLocalPlayerNameFromEnv();

	if (argc > 0) {
		parameters.applicationName = argv[0];
	}

	// FIXME: Parse options before or after scripts?
	ParseCommandLine(argc, argv, parameters);
	// Init the random number generator.
	InitSyncRand();

	makedir(parameters.GetUserDirectory().c_str(), 0777);

	// Init Lua and register lua functions!
	InitLua();
	LuaRegisterModules();

	// Initialise AI module
	InitAiModule();

	LoadCcl(parameters.luaStartFilename);

	PrintHeader();
	PrintLicense();

	// Setup video display
	InitVideo();

	// Setup sound card
	if (!InitSound()) {
		InitMusic();
	}

#ifndef DEBUG           // For debug it's better not to have:
	srand(time(NULL));  // Random counter = random each start
#endif

	//  Show title screens.
	SetDefaultTextColors(FontYellow, FontWhite);
	LoadFonts();
	SetClipping(0, 0, Video.Width - 1, Video.Height - 1);
	Video.ClearScreen();
	ShowTitleScreens();

	// Init player data
	ThisPlayer = NULL;
	//Don't clear the Players strucure as it would erase the allowed units.
	// memset(Players, 0, sizeof(Players));
	NumPlayers = 0;

	UnitManager.Init(); // Units memory management
	PreMenuSetup();     // Load everything needed for menus

	MenuLoop();

	Exit(0);
	return 0;
}
示例#29
0
//---------------------------------------------------------------------------------
int main(int argc, char **argv) 
	{
	InitVideo ();

	printf ("\n");
	printd ("---------------------------------------------------------------------------\n");
	printd ("                        priibooter "VER" by stfour\n");
	printd ("                       (part of postLoader project)\n");
	printd ("---------------------------------------------------------------------------\n");
	
	PAD_Init(); 
	WPAD_Init();

	// Let's mount devices
	int sd,usb;
	
	sd = Fat_Mount (DEV_SD, &keypressed);
	usb = Fat_Mount (DEV_USB, &keypressed);
	
	if (sd == 0 && usb == 0)
		{
		printd ("SD & USB not available, booting to System Menu\n");
		sleep(3);
		BootToMenu ();
		}

	if (sd && FileExist (POSTLOADER_SD))
		pl_sd = 1;

	if (sd && FileExist (POSTLOADER_SDAPP))
		pl_sd = 1;

	if (usb && FileExist (POSTLOADER_USB))
		pl_usb = 1;

	if (usb && FileExist (POSTLOADER_USBAPP))
		pl_usb = 1;

	
	printf ("\n");
	
	if (sd && !DirExist ("sd://ploader"))
		mkdir ("sd://ploader", S_IREAD | S_IWRITE);
		
	LoadPLN ();

	if (pl_sd == 0 && pl_usb == 0)
		{
		printd ("postLoader.dol not found on sd/usb");
		
		if (pln.bootMode != PLN_BOOT_NEEK)
			keypressed = 1;
		}

	// On the sd we should have plneek.dat... it will instruct us what to do
	nandSource = NULL;

	if (sd)
		{
		printd ("Checking "PLNEEK_DAT"\n");
		nandSource = (char*)ReadFile2Buffer (PLNEEK_DAT, NULL, NULL);
		}
		
	if (nandSource)
		{
		GetNandsFolders ();

		char *p;
		
		p = nandSource+strlen(nandSource)-1;
		while (*p != '/' && p > nandSource) p--;
		if (*p == '/') p++;
		
		strcpy (pln.name, p);
		printd (PLNEEK_DAT" found -> '%s'\n", nandSource);

		// If nandSource isn't null, we have to copy selected nand. But before check if we have a nand on the root... if exist it must be backed up
		StoreCurrentNand ();
			
		// Now we can move back the selected nand
		MoveNewNand ();
		}
	
	// After read remove the configuration file. If something fail, doesn't do it again
	remove (PLNEEK_DAT);

	GetNandsFolders ();
	Boot ();
		
	exit (0);
	}
示例#30
0
ProcessControls()
{
  int xmax, ymax;

  xmax = (layer[0].sizex * 16) - sx;
  ymax = (layer[0].sizey * 16) - sy;

  if (key[SCAN_F5]) { key[SCAN_F5]=0; ShellMAP(); }
  if (key[SCAN_F6]) { key[SCAN_F6]=0; CompileAll(); }
  if (key[SCAN_F8]) { key[SCAN_F8]=0; ShellVERGE(); }
  if (key[SCAN_ALT] && key[SCAN_D]) { key[SCAN_D]=0; ShellToDOS(); }
  if (key[SCAN_ALT] && key[SCAN_L]) LoadMAPDialog();
  if (key[SCAN_ALT] && key[SCAN_V]) ShellEditMAP();
  if (key[SCAN_ALT] && key[SCAN_S]) ShellEditSystem();
  if (key[SCAN_ALT] && key[SCAN_N]) NewMAP();
  if (key[SCAN_ALT] && key[SCAN_P]) MPDialog();
  if (!key[SCAN_ALT] && key[SCAN_P]) { pasting^=1; key[SCAN_P]=0; } // aen

  if (key[SCAN_A] && el<6)
  {
    lt++;
    if (lt==numtiles) lt=0;
    key[SCAN_A]=0;
  }
  if (key[SCAN_Z] && el<6)
  {
    if (lt) lt--;
    else lt=numtiles-1;
    key[SCAN_Z]=0;
  }
  if (key[SCAN_A] && el==7)
  {
    curzone++;
    key[SCAN_A]=0;
  }
  if (key[SCAN_Z] && el==7)
  {
    curzone--;
    key[SCAN_Z]=0;
  }
  if (key[SCAN_S])
  {
    rt++;
    if (rt==numtiles) rt=0;
    key[SCAN_S]=0;
  }
  if (key[SCAN_X])
  {
    if (rt) rt--;
    else rt=numtiles-1;
    key[SCAN_X]=0;
  }
  if (key[SCAN_F10])
  {
    key[SCAN_F10]=0;
    if (random(0,255)<15) HAL();
    SaveMAP(mapname);
    SaveVSP(vspname);
    CompileMAP();
    Message("MAP/VSP saved.",100);
    modified=0;
  }
  if (key[SCAN_C])
  {
    key[SCAN_C]=0;
    sprintf(strbuf,"Left: %d Right: %d", lt, rt);
    Message(strbuf, 300);
  }
  if (key[SCAN_M])
  {
    key[SCAN_M]=0;
    GenerateMiniVSP();
    MiniMAP();
  }
  if (key[SCAN_H])
  {
    key[SCAN_H]=0;
    mh=mh^1;
    if (mh) Message("MAP Tile Highlight enabled.",100);
       else Message("MAP Tile Highlight disabled.",100);
  }

  // ***
  // movement code moved to PollMovement()
  // ***

  if (key[SCAN_PGUP])
  {
    key[SCAN_PGUP]=0;
    ywin -= sy;
    if (ywin < 0)
      ywin = 0;
  }
  if (key[SCAN_HOME])
  {
    key[SCAN_HOME]=0;
    xwin -= sx;
    if (xwin < 0)
      xwin = 0;
  }
  if (key[SCAN_END])
  {
    key[SCAN_END]=0;
    xwin += sx;
    if (xwin > xmax)
      xwin = xmax;
  }
  if (key[SCAN_PGDN])
  {
    key[SCAN_PGDN]=0;
    ywin += sy;
    if (ywin > ymax)
      ywin = ymax;
  }

  if (key[SCAN_CTRL] && el<6)
  {
    key[SCAN_CTRL]=0;
    TileSelector();
  }
  if (key[SCAN_CTRL] && el==7)
  {
    key[SCAN_CTRL]=0;
    ZoneEdDialog();
  }

  if (key[SCAN_TAB])
  {
    key[SCAN_TAB]=0;
    if (scrollmode)
    {
      scrollmode=0;
      xwin=xwin/16; xwin=xwin*16;
      ywin=ywin/16; ywin=ywin*16;
      Message("Tile scroll.",150);
    }
    else
    {
      scrollmode=1;
      Message("Pixel scroll.",150);
    }
  }

  if (key[SCAN_1])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[0]=0;
       return;
     }
     layertoggle[0]=1;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     el=0;
     key[SCAN_1]=0;
  }
  if (key[SCAN_2])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[1]=0;
       return;
     }
     key[SCAN_2]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>1)
     { layertoggle[1]=1;
       el=1; }
  }
  if (key[SCAN_3])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[2]=0;
       return;
     }
     key[SCAN_3]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>2)
     { layertoggle[2]=1;
       el=2; }
  }
  if (key[SCAN_4])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[3]=0;
       return;
     }
     key[SCAN_4]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>3)
     { layertoggle[3]=1;
       el=3; }
  }
  if (key[SCAN_5])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[4]=0;
       return;
     }
     key[SCAN_5]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>4)
     { layertoggle[4]=1;
       el=4; }
  }
  if (key[SCAN_6])
  {
     if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT])
     {
       layertoggle[5]=0;
       return;
     }
     key[SCAN_6]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     if (numlayers>5)
     { layertoggle[5]=1;
       el=5; }
  }
  if (key[SCAN_O])
  {
     key[SCAN_O]=0;
     layertoggle[6]=1; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=0;
     el=6;
  }
  if (key[SCAN_N])
  {
     key[SCAN_N]=0;
     layertoggle[6]=0; layertoggle[7]=1;
     layertoggle[8]=0; layertoggle[9]=0;
     el=7;
  }
  if (key[SCAN_E])
  {
     key[SCAN_E]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=1; layertoggle[9]=0;
     el=8;
  }
  if (key[SCAN_T])
  {
     key[SCAN_T]=0;
     layertoggle[6]=0; layertoggle[7]=0;
     layertoggle[8]=0; layertoggle[9]=1;
     el=9;
  }
  if (key[SCAN_F9])
  { // aen
    key[SCAN_F9]=0;
    mouse_scroll^=1;
    sprintf(strbuf,"Mouse scroll %sabled.", mouse_scroll ? "en" : "dis");
    Message(strbuf, 100);
  }
  if (key[SCAN_F11])
  {
    key[SCAN_F11]=0;
    ScreenShot();
    Message("Screen capture saved.",300);
  }
  if (key[SCAN_F12])
  {
    key[SCAN_F12]=0;
    OutputVSPpcx();
    Message("PCX file exported.",300);
  }
  if (key[SCAN_LANGLE])
  {
      key[SCAN_LANGLE]=0;
      ShutdownVideo();
      vm=0;
      InitVideo(0);
      set_intensity(63);
      InitMouse();

      // aen -- gotta recalc this if you're in a lower res at the bottom of
      //        the map and jump to a higher res.
      xmax = (layer[0].sizex * 16) - sx;
      ymax = (layer[0].sizey * 16) - sy;
      if (xwin > xmax) xwin=xmax;
      if (ywin > ymax) ywin=ymax;
  }
  if (key[SCAN_RANGLE])
  {
      key[SCAN_RANGLE]=0;
      ShutdownVideo();
      vm=1;
      InitVideo(1);
      set_intensity(63);
      InitMouse();

      // aen -- gotta recalc this if you're in a lower res at the bottom of
      //        the map and jump to a higher res.
      xmax = (layer[0].sizex * 16) - sx;
      ymax = (layer[0].sizey * 16) - sy;
      if (xwin > xmax) xwin=xmax;
      if (ywin > ymax) ywin=ymax;
  }

  if (CheckMouseTabs()) return;

  if (mb>=3) MainMenu(mx-4,my-5);
  if (key[SCAN_ESC]) DoMainMenu();

  if (mb==1 && key[SCAN_SLASH] && el<6)
  {
    lt=layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
             layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16)];

    return;
  }

  if (mb==2 && key[SCAN_SLASH] && el<6)
  {
    rt=layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
             layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16)];
    return;
  }

  // aen; these must come before the tile plotting code just below
  // to work correctly.
  if (mb && el<6 && key[SCAN_LSHIFT] && !shifted)
  {
    selx1=(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16);
    sely1=(((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16);
    selx2=selx1;
    sely2=sely1;
    shifted=mb;
    return;
  }
  if (mb && el<6 && shifted)
  {
    selx2=(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16);
    sely2=(((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16);
    return;
  }
  if (!mb && el<6 && shifted)
  { int i,j;
    int x1,y1,x2,y2;

    x1=selx1;
    y1=sely1;
    x2=selx2;
    y2=sely2;

    if (x2<x1) x2^=x1,x1^=x2,x2^=x1;
    if (y2<y1) y2^=y1,y1^=y2,y2^=y1;

    copybuf_wide=x2-x1+1;
    copybuf_deep=y2-y1+1;

    if (shifted==2)
    {
      // block fill
      modified=1;
      for (j=0; j<copybuf_deep; j++)
      {
        for (i=0; i<copybuf_wide; i++)
          layers[el][((y1+j)*layer[el].sizex)+(x1+i)]=lt;
      }
    }

    if (shifted==1)
    {
      modified=1;
      if (copybuf) vfree(copybuf);
      copybuf=(word *)valloc(copybuf_wide*copybuf_deep*2, "copybuf", 0);

      // copy
      for (j=0; j<copybuf_deep; j++)
      {
        for (i=0; i<copybuf_wide; i++)
          copybuf[(j*copybuf_wide)+i]=layers[el][((y1+j)*layer[el].sizex)+(x1+i)];
      }
      pasting=1;
    }
    selx1=sely1=0;
    selx2=sely2=0;
    shifted=0;
  }
  if (mb==1 && el<6 && !shifted && pasting)
  { int a,b,i,j;

    a=(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)/16);
    b=(((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16);

    // paste
    for (j=0; j<copybuf_deep; j++)
    {
      for (i=0; i<copybuf_wide; i++)
      {
        if (b+j<layer[el].sizey && a+i<layer[el].sizex)
          layers[el][((b+j)*layer[el].sizex)+(a+i)]=copybuf[(j*copybuf_wide)+i];
      }
    }
  }

  if (mb==1 && el<6 && !shifted && !pasting)
  {
    if (mx>335) mx=334;
    modified=1;
    layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
               layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)
               /16)]=lt;
  }
  if (mb==2 && el<6 && !shifted)
  {
    if (mx>335) mx=334;
    modified=1;
    layers[el][((((ywin*layer[el].pmulty/layer[el].pdivy)+my-16)/16) *
               layer[el].sizex)+(((xwin*layer[el].pmultx/layer[el].pdivx)+mx-16)
               /16)]=rt;
  }

  if (mb==1 && el==6)
  {
   modified=1;
   obstruct[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=1;
  }
  if (mb==2 && el==6)
  {
   modified=1;
   obstruct[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=0;
  }
  if (mb==1 && el==7 && (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]))
  {
   curzone=zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)];
   WaitRelease();
   ZoneEdDialog();
   return;
  }
  if (mb==1 && el==7)
  {
   modified=1;
   zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=curzone;
  }
  if (mb==2 && el==7)
  {
   modified=1;
   zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
               layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)
               /16)]=0;
  }
  if (mb==1 && el==8)
  {
     WaitRelease();
     ProcessEntity((xwin+(mx-16))/16,(ywin+(my-16))/16);
     modified=1;
  }
  if (el==8 && EntityThere((mx-16+xwin)/16,(my+ywin-16)/16) &&
      key[SCAN_DEL])
  {
    WaitRelease();
    DeleteEntity((mx-16+xwin)/16,(my-16+ywin)/16);
    modified=1;
  }
}