Beispiel #1
0
void SmpDispLoadFrame(UINT8 dst, UINT8 sel)
{
	UINT32 len;

	if(dst > GE_B1)
		dst = GE_B1;

	if(sel >= SMP_FRAME_TOTAL_NUM)
		sel = SMP_FRAME_TOTAL_NUM - 1;

	if(gVC0568ChipID == MASS_VER)
		len = LoadImageFile(FrameGroup_Mass[sel].path, gTransferBuf, SMP_MAIN_MENU_IMAGE_SIZE);
	if(gVC0568ChipID == DESIGNIN_VER)
		len = LoadImageFile(FrameGroup_Din[sel].path, gTransferBuf, SMP_MAIN_MENU_IMAGE_SIZE);

	if(dst == GE_B0)
	{
		V5_LoadBmp((UINT8*)gTransferBuf, GE_B0);
		if(gVC0568ChipID == MASS_VER)
			V5B_LcdcSetB0OverKeyColor(FrameGroup_Mass[sel].keycolor);
		if(gVC0568ChipID == DESIGNIN_VER)
			V5B_LcdcSetB0OverKeyColor(FrameGroup_Din[sel].keycolor);
		gSmpDispContext.fore_id = sel;
	}
	else
	{
		V5_LoadBmp((UINT8*)gTransferBuf, GE_B1);
		gSmpDispContext.back_id = sel;
	}
}
Beispiel #2
0
void DisplayCanvas::LoadAllImages()
{
    for(int i=0; i<52; i++)
    {
        ostringstream ImageName;
        ImageName << "./res/Files/AllCards/Ascending/";
        ImageName<<"C"<<i+1<<".png";
        GLuint CurrentImage = LoadImageFile(ImageName.str());
        Image[i] = CurrentImage;
    }
    Image[52] = LoadImageFile(string("./res/Files/AllCards/Back/RedBack.png"));
    Image[53] = LoadImageFile(string("./res/Files/AllCards/Back/BlueBack.png"));
}
Beispiel #3
0
	CGameWindow()
		: CFKWindow( 640,480,false )
		, m_Player( Graphics(), Audio() )
		, m_Font( Graphics(), FK2DEngine::DefaultFontName(), 24 )
		, m_nFps( 0 )
		, m_nLastFps( 0 )
	{
		SetCaption( L"自由骑士笃志引擎:DEMO1" );

		std::wstring szFileName = FK2DEngine::ShareResourcePrefix() + L"rc/media/Space.png";
		m_pBackgroundImage.reset( new FK2DEngine::CImage( Graphics(), szFileName, false ) );

		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc/media/Star.png";
		FK2DEngine::ImagesFromTiledBitmap( Graphics(), szFileName, 25, 25, false, m_StarAnim );

		m_Player.Warp( 320, 240 );

		//szFileName = FK2DEngine::ShareResourcePrefix() + L"avgRc\\Attack.cur";
		//SetNewCursor( szFileName );

		szFileName = FK2DEngine::ShareResourcePrefix() + L"avgRc\\AnimCursor.bmp";
		m_pCursorBitmap = LoadImageFile( szFileName );
		SSAnimationCursorManager::Instance()->AddCursor( m_pCursorBitmap, L"默认鼠标", 32, 32 );
		SSAnimationCursorManager::Instance()->SetAnimCursor( L"默认鼠标" );
		SSAnimationCursorManager::Instance()->Enable( true );
	}
Beispiel #4
0
INT_PTR MainDlg::OnLoadImage( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    OPENFILENAMEW ofn = { 0 };
    wchar_t path[MAX_PATH] = { 0 };
    BOOL bSucc = FALSE;

    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = NULL;
    ofn.lpstrFile = path;
    ofn.lpstrFile[0] = '\0';
    ofn.nMaxFile = MAX_PATH;
    ofn.lpstrFilter = TEXT( "All (*.*)\0*.*\0Dynamic link library (*.dll)\0*.dll\0" );
    ofn.nFilterIndex = 2;
    ofn.lpstrFileTitle = NULL;
    ofn.nMaxFileTitle = 0;
    ofn.lpstrInitialDir = NULL;
    ofn.Flags = OFN_PATHMUSTEXIST;

    bSucc = GetOpenFileName( &ofn );
    if (bSucc)
    {
        Edit_SetText( GetDlgItem( hDlg, IDC_IMAGE_PATH ), path );
        LoadImageFile( path );
    }

    return (INT_PTR)TRUE;
}
Beispiel #5
0
// ---------------
// CreateRunObject
// ---------------
// The routine where the object is actually created
// 
short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr)
{
/*
   This routine runs when your object is created, as you might have guessed.
   It is here that you must transfer any data you need in rdPtr from edPtr,
   because after this has finished you cannot access it again!
   Also, if you have anything to initialise (e.g. dynamic arrays, surface objects)
   you should do it here, and free your resources in DestroyRunObject.
*/
	rdPtr->rHo.hoX = cobPtr->cobX;
	rdPtr->rHo.hoY = cobPtr->cobY;
	rdPtr->rHo.hoImgWidth = edPtr->nWidth;
	rdPtr->rHo.hoImgHeight = edPtr->nHeight;

	// Initialize RUNDATA members
	rdPtr->dwOptions = edPtr->dwOptions;
	rdPtr->dwTranspColor = edPtr->dwTranspColor;
	strcpy(rdPtr->sFilename, edPtr->sFilename);
	rdPtr->pColMask = NULL;

	// Load image
	LoadImageFile(rdPtr, rdPtr->sFilename);

	// No errors
	return 0;
}
Beispiel #6
0
//---------------------------------------------------------------------------
bool uv_image::initialize(attribute init)
{
   loaded=false;
   w=0;
   h=0;

   //Display-Listen Zeugs:
   if(!(stranslation = glGenLists(3)))
      return false; //Error !!
   drawing = stranslation+1;
   etranslation = drawing+1;

   uv_widget::initialize(uv_widget::make_attribut(init.parent, init.x, init.y,
                         init.width, init.height, init.name, false));

   //Position und Grösse des Bildes setzen
   set_size(init.x, init.y, init.width, init.height,
            init.picx, init.picy, init.picw, init.pich);

   LoadImageFile(init.image.c_str());

//   picx = -1; picy = -1; picw = -1; pich = -1;

   redraw = true;
   retranslate = true;

   //Initialisierung erfolgt
   is_init = true;

   return true;
};
Beispiel #7
0
int CFontGen::AddIconImage(const char *file, int id, int xoffset, int yoffset, int advance)
{
	assert(!isWorking);
	arePagesGenerated = false;

	// Load the image file
	acImage::Image rawImg;
	int r = LoadImageFile(file, rawImg);
	if( r < 0 )
		return -r;

	acImage::Image rgbImg;
	acImage::ConvertToARGB(rgbImg, rawImg);

	cImage *image = new cImage(rgbImg.width, rgbImg.height);
	memcpy(image->pixels, rgbImg.data, rgbImg.width*rgbImg.height*4);

	SIconImage *i = new SIconImage;
	i->fileName = file;
	i->id       = id;
	i->image    = image;
	i->xoffset  = xoffset;
	i->yoffset  = yoffset;
	i->advance  = advance;

	iconImages.push_back(i);

	return 0;
}
Beispiel #8
0
BOOL CEnBitmap::LoadImage(LPCTSTR szImagePath, COLORREF crBack)
{
	ASSERT(m_hObject == NULL);      // only attach once, detach on destroy

	if (m_hObject != NULL)
		return FALSE;

	return Attach(LoadImageFile(szImagePath, crBack));
}
Beispiel #9
0
void File2pc(char *src, char *buf)
{
	int len;

#ifdef WIN32
	len = buf[0];
#endif
	len = LoadImageFile(src, gTransferBuf, 0x80000);
	tmWriteBuf((char *)&len, sizeof(len));
	tmWriteBuf(gTransferBuf, len);
}
Beispiel #10
0
INT_PTR MainDlg::OnDragDrop( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    wchar_t path[MAX_PATH] = { 0 };
    HDROP hDrop = (HDROP)wParam;

    if(DragQueryFile( hDrop, 0, path, ARRAYSIZE( path ) ) != 0)
    {
        Edit_SetText( GetDlgItem( hDlg, IDC_IMAGE_PATH ), path );
        LoadImageFile( path );
    }

    return (INT_PTR)TRUE;
}
Beispiel #11
0
INT_PTR MainDlg::OnDragDrop( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    wchar_t path[MAX_PATH] = { 0 };
    HDROP hDrop = (HDROP)wParam;

    if (DragQueryFile( hDrop, 0, path, ARRAYSIZE( path ) ) != 0)
    {
        // Reset init routine
        if (LoadImageFile( path ) == ERROR_SUCCESS)
            _profileMgr.config().initRoutine = L"";
    }

    return 0;
}
Beispiel #12
0
	void ResourceManager::SetEnemy(const ResourceHandle& hResource, const wstring& imageName)
	{
		//テクスチャ
		auto newTex = new Texture();
		newTex->LoadImageFile(*m_g, imageName);
		m_textures.push_back(newTex);
		//イデアの設定
		auto newResource = new Idea();
		newResource->SetTexture(*newTex);

		//当たり判定の設定

		//セット
		m_resources.emplace(hResource,newResource);
	}
Beispiel #13
0
INT_PTR MainDlg::OnLoadImage( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    std::wstring path;
    bool res = OpenSaveDialog(
        L"All (*.*)\0*.*\0Dynamic link library (*.dll)\0*.dll\0System driver (*.sys)\0*.sys\0",
        (_profileMgr.config().injectMode == Kernel_DriverMap) ? 3 : 2,
        path 
        );

    // Reset init routine upon load
    if (res && LoadImageFile( path ) == ERROR_SUCCESS)
        _profileMgr.config().initRoutine = L"";

    return TRUE;
}
Beispiel #14
0
MixedApp::MixedApp(HINSTANCE instance)
    : Window(nullptr)
{
#if HACK_GENERATE_GAUSSIAN_KERNEL // Move this somewhere else!
    float o = 0.9f;     // scale
    float matrix[7]{};  // -3 to 3
    float sum = 0.f;
    for (int i = -3; i <= 3; ++i)
    {
        matrix[i + 3] = exp(-(i * i) / (2 * o * o)) / sqrtf(2 * XM_PI * (o * o));
        sum += matrix[i + 3];
    }

    // Normalize
    for (int i = -3; i <= 3; ++i)
    {
        matrix[i + 3] = matrix[i + 3] / sum;
    }
#endif

    CoInitializeEx(nullptr, COINIT_MULTITHREADED);

    HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&WicFactory));
    CHECKHR(hr, L"Failed to create WIC factory. hr = 0x%08x.", hr);

    InitializeWindow(instance);
    Renderer.reset(new ::Renderer(Window));

    uint32_t width = 0, height = 0;
    std::unique_ptr<uint8_t[]> pixels = LoadImageFile(L"car2.jpg", &width, &height);

    Color = Renderer->CreateColorImage(width, height, (const uint32_t*)pixels.get());
    Lum = Renderer->CreateLuminanceImage(width, height, nullptr);
    Norm = Renderer->CreateNormalsImage(width, height, nullptr);
    Blurred = Renderer->CreateColorImage(width, height, nullptr);
    Edges1 = Renderer->CreateLuminanceImage(width, height, nullptr);
    Edges2 = Renderer->CreateLuminanceImage(width, height, nullptr);

    Renderer->ColorToLum(Color, Lum);
    Renderer->LumToNormals(Lum, Norm);
    Renderer->Gaussian(Color, Blurred);
    Renderer->EdgeDetect(Color, Edges1);
    Renderer->EdgeDetect(Blurred, Edges2);
}
Beispiel #15
0
int SphrWarp(int argc, const char *argv[])
{
    // Warp the input image to correct for radial distortion and/or map to spherical coordinates
    if (argc < 5)
    {
        printf("usage: %s input.tga output.tga f [k1 k2]\n", argv[1]);
        return -1;
    }
    const char *infile  = argv[2];
	const char *outfile = argv[3];
	float f             = (float) atof(argv[4]);
	float k1            = (argc > 5) ? (float) atof(argv[5]) : 0.0f;
	float k2            = (argc > 6) ? (float) atof(argv[6]) : 0.0f;

	CByteImage src, dst, temp;

	/* Added by Adarsh */
	{
		bool success = LoadImageFile(infile, src);
		if (!success) {
			printf("couldn't load image 1\n");
			return -1;
		}
		else
		{
			printf("Done loading file\n");
		}
	}

	CShape sh = src.Shape();

    CTransform3x3 R;

#define THETA 0.0 // 0.1638
    R[0][0] = 1.0;  R[0][1] = 0.0;  R[0][2] = 0.0;
    R[1][0] = 0.0; R[1][1] = cos(THETA); R[1][2] = -sin(THETA);
    R[2][0] = 0.0; R[2][1] = sin(THETA);  R[2][2] = cos(THETA);

    // CFloatImage uv = WarpSphericalField(sh, sh, f, k1, k2, CTransform3x3());
    CFloatImage uv = WarpSphericalField(sh, sh, f, k1, k2, R);
    WarpLocal(src, dst, uv, false, eWarpInterpLinear);
    WriteFile(dst, outfile);
    return 0;
}
Beispiel #16
0
void ShowMediaPanel( struct my_button *media )
{
    INDEX idx;
    struct media_control_panel *panel;
    LIST_FORALL( l.controls, idx, struct media_control_panel *, panel )
    {
        if( panel->media == media )
            break;
    }
    if( !panel )
    {
        PSI_CONTROL newPanel = MakeNamedControl( NULL, MyName, 0, 0, 500, 75, -1 );
        MyValidatedControlData(struct media_control_panel*,  new_panel, newPanel );
        panel = new_panel;
        panel->media = media;
        panel->flags.playing = 1; // is playing, otherwise media panel wouldn't be showing...
        panel->knob = MakeNamedControl( newPanel, CONTROL_SCROLL_KNOB_NAME, 0, 0, 50, 50, -1 );
        panel->knob_image = LoadImageFile( WIDE( "images/dial2a.png" ) );
        SetScrollKnobImage( panel->knob, panel->knob_image );
        SetScrollKnobEvent( panel->knob, KnobTick, (uintptr_t)panel );
        panel->stop_button = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 0, 50, 25, -1, "Stop" );
        SetButtonPushMethod( panel->stop_button, stop_pushed, (uintptr_t)panel );
#ifdef _DEBUG
        panel->debug_mem_button = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 100, 55, 100, 25, -1, "Debug Memory" );
        SetButtonPushMethod( panel->debug_mem_button, debug_mem, (uintptr_t)panel );
#endif
        panel->pause_button = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 25, 50, 25, -1, "Pause" );
        SetButtonPushMethod( panel->pause_button, pause_pushed, (uintptr_t)panel );
        panel->progress = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 50, 50, 25, -1, "???" );
        //panel->progress = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 75, 50, 25, -1, "???" );
        panel->seek_slider = MakeNamedControl( newPanel, SLIDER_CONTROL_NAME,100, 0, 400, 50, -1 );
        SetSliderOptions( panel->seek_slider, SLIDER_HORIZ );
        SetSliderValues( panel->seek_slider, 0, 0, 10000 );  // 100.00%
        SetSliderUpdateHandler( panel->seek_slider, seek_changed, (uintptr_t)panel );
        DisplayFrame( newPanel );
    }
    else
    {
        // have an existing panel to just show.
        RevealCommon( panel->panel );
    }
    ffmpeg_SetPositionUpdateCallback( panel->media->file, video_position_update, (uintptr_t)panel );
}
Beispiel #17
0
	void ResourceManager::SetBullet(const ResourceHandle& hResource, const wstring& imageName,
		const Rect& screen, const int margin)
	{
		//テクスチャ
		auto newTex = new Texture();
		newTex->LoadImageFile(*m_g,imageName);
		m_textures.push_back(newTex);
		//イデアの設定
		auto newResource = new Idea();
		newResource->SetTexture(*newTex);

		//当たり判定の設定

		//画面外の設定
		newResource->SetActiveRange(screen, margin);

		//セット
		m_resources.emplace(hResource,newResource);
	}
Beispiel #18
0
int CFontGen::UpdateIconImage(int oldId, int id, const char *file, int xoffset, int yoffset, int advance)
{
	assert(!isWorking);
	arePagesGenerated = false;

	// Find the icon image for update
	bool isFound = false;
	for( int n = 0; n < (signed)iconImages.size(); n++ )
	{
		if( iconImages[n]->id == oldId )
		{
			isFound = true;
			iconImages[n]->id = id;
			iconImages[n]->xoffset = xoffset;
			iconImages[n]->yoffset = yoffset;
			iconImages[n]->advance = advance;

			if( iconImages[n]->fileName != file )
			{
				// Load the image file
				acImage::Image rawImg;
				int r = LoadImageFile(file, rawImg);
				if( r < 0 )
					return -r;

				acImage::Image rgbImg;
				acImage::ConvertToARGB(rgbImg, rawImg);

				cImage *image = new cImage(rgbImg.width, rgbImg.height);
				memcpy(image->pixels, rgbImg.data, rgbImg.width*rgbImg.height*4);

				iconImages[n]->fileName = file;
				delete iconImages[n]->image;
				iconImages[n]->image = image;
			}

			break;
		}
	}

	return isFound ? 0 : -1;
}
Beispiel #19
0
HBITMAP CImage::HttpOpen( CString url, CString cookie )
{
    // 指定された URL の画像ファイルを読み、ビットマップを生成する
    char    *response;
    char    *cookieString;
    size_t  sz  = 65536 * 256;
    HBITMAP ret = NULL;

    response = new char[sz];
    if ( !response )
        return ret;
    cookieString = new char[MAX_COOKIE_LEN + 2];
    if ( !cookieString ) {
        delete [] response;
        return ret;
    }
    strcpy( cookieString, cookie );

    setUpReceiveBuffer( response, sz );
    http_getEx( url, response, cookieString );
    if ( *response ) {
        size_t  sz = getBinSize();
        if ( sz > 0 ) {
            CString fileName = "tmp.img";
            FILE    *fp      = fopen( fileName, "wb" );
            if ( fp ) {
                fwrite( response, sz, 1, fp );
                fclose( fp );
                ret = LoadImageFile( fileName );
            }
        }
    }

    delete [] cookieString;
    delete [] response;
    encodeURL( NULL );

    return ret;
}
Beispiel #20
0
void GenerateSprites( PRENDERER renderer, int x, int y )
{
	int n;
#ifdef DISABLE_SPRITES
	return;
#endif
	{
		for( n = 0; n < USE_SPRITES; n++ )
		{
			sprite[n].ttl = (rand() * 20) / RAND_MAX + 8;
			if( !sprite[n].sprite )
			{
				if( !l.image )
					l.image = LoadImageFile( WIDE( "images/firestar2.png" ) );

				if( !l.psm )
					l.psm = EnableSpriteMethod( renderer, SpriteDrawProc, 0 );
				sprite[n].sprite = MakeSpriteImage( l.image );
				if( !sprite[n].sprite )
					return;
				sprite[n].sprite->pSpriteMethod = l.psm;//psm;
				sprite[n].ttl = (rand() * 300) / RAND_MAX + 50;
				sprite[n].sprite->curx = rand() * 500 / RAND_MAX;
				sprite[n].sprite->cury = rand() * 500 / RAND_MAX;
				sprite[n].dx = 15 - ( rand() * 31 / RAND_MAX );
				sprite[n].dy = 15 - ( rand() * 31 / RAND_MAX );
				sprite[n].sprite->hotx = l.image->width / 2;
				sprite[n].sprite->hoty = l.image->height / 2;			
			}
			sprite[n].sprite->curx = x;
			sprite[n].sprite->cury = y;
			sprite[n].dx = 15 - ( rand() * 31 / RAND_MAX );
			sprite[n].dy = 15 - ( rand() * 31 / RAND_MAX );
		}
		l.renderer = renderer;
	}
}
Beispiel #21
0
void AddImage( char *name )
{
   PIMAGE_DISPLAY pdi;
	pdi = New( IMAGE_DISPLAY );

	pdi->Loaded = LoadImageFile( name );
	if( !pdi->Loaded )
	{
		Release( pdi );
      return;
	}
   pdi->display = OpenDisplaySizedAt( 0
												, pdi->Loaded->width, pdi->Loaded->height
												, g.x, g.y );
	SetRedrawHandler( pdi->display, DrawImage, (uintptr_t)pdi );
   DrawImage( (uintptr_t)pdi, pdi->display );
	SetKeyboardHandler( pdi->display, KeyHandler, 0 );
	g.x += 10;
   g.y += 10;
	if( ( pdi->next = g.images ) )
      pdi->next->me = &pdi->next;
	pdi->me = &g.images;
	g.images = pdi;
}
Beispiel #22
0
INT_PTR MainDlg::OnInit( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    _hMainDlg = hDlg;

    // Set dialog title
    SetRandomTitle();
/*#ifdef _M_AMD64
    SetWindowText( hDlg, L"Xenos64" );
#endif*/

    // Fill inject methods
    HWND hOpTypeList = GetDlgItem( hDlg, IDC_OP_TYPE );

    ComboBox_AddString( hOpTypeList, L"Native inject" );
    ComboBox_AddString( hOpTypeList, L"Manual map" );
    ComboBox_SetCurSel( hOpTypeList, 0 );

    EnableWindow( GetDlgItem( hDlg, IDC_CMDLINE ), FALSE );
    EnableWindow( GetDlgItem( hDlg, IDC_WIPE_HDR ), FALSE );
    EnableWindow( GetDlgItem( hDlg, IDC_LDR_REF ), FALSE );
    EnableWindow( GetDlgItem( hDlg, IDC_MANUAL_IMP ), FALSE );
    EnableWindow( GetDlgItem( hDlg, IDC_IGNORE_TLS ), FALSE );
    EnableWindow( GetDlgItem( hDlg, IDC_NOEXCEPT), FALSE );

    // Set icon
    HICON hIcon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );

    SendMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon );
    SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon );

    ConfigMgr::ConfigData cfg;
    if (_config.Load( cfg ))
    {
        // Image
        if (!cfg.imagePath.empty())
        {
            Edit_SetText( GetDlgItem( hDlg, IDC_IMAGE_PATH ), cfg.imagePath.c_str() );
            LoadImageFile( cfg.imagePath.c_str() );
        }

        // Process
        if (!cfg.procName.empty())
        {
            DWORD pid = 0xFFFFFFFF;

            if (!cfg.newProcess && !cfg.procName.empty())
            {
                std::vector<DWORD> procList;
                blackbone::Process::EnumByName( cfg.procName, procList );
                pid = !procList.empty() ? procList.front() : 0xFFFFFFFF;
            }

            SetActiveProcess( cfg.newProcess, cfg.procName.c_str(), pid );
        }

        if (!cfg.procCmdLine.empty())
            SetDlgItemTextW( _hMainDlg, IDC_CMDLINE, cfg.procCmdLine.c_str() );

        if (!cfg.initArgs.empty())
            SetDlgItemTextW( _hMainDlg, IDC_ARGUMENT, cfg.initArgs.c_str() );

        if (!cfg.initRoutine.empty())
            SetDlgItemTextW( _hMainDlg, IDC_INIT_EXPORT, cfg.initRoutine.c_str() );

        if (cfg.unlink)
            Button_SetCheck( GetDlgItem( _hMainDlg, IDC_UNLINK ), TRUE );

        if (cfg.manualMap)
            ComboBox_SetCurSel( GetDlgItem( _hMainDlg, IDC_OP_TYPE ), 1 );

        SetMapMode( cfg.manualMap ? Manual : Normal );
        MmapFlags( cfg.manualMapFlags );
    }    

    return (INT_PTR)TRUE;
}
Beispiel #23
0
SaneWinMain(argc, argv )
//int main( int argc, char **argv )
{
	int x = 0;
	int y = 0;
	uint32_t width, height;
	int w, h;
	g.pdi = GetDisplayInterface();
	g.pii = GetImageInterface();
	RegisterIcon( NULL );
	GetDisplaySize( &width, &height );
	w = width; h = height;


	y = x  = 0;

	{
		int state = 0;
		int arg;
		g.fade_in = 500;
		g.show_time = 1000;
		for( arg = 1; arg < argc; arg++ )
		{

			if( argv[arg][0] == '-' )
			{
				if( argv[arg][1] == 'i' )
				{
					g.flags.bShowInverted = 1;
				}
				else
				{
					switch( state )
					{
					case 0:
						x = atoi( argv[arg]+1 );
						break;
					case 1:
						y = atoi( argv[arg]+1 );
						break;
					case 2:
						w = atoi( argv[arg]+1 );
						break;
					case 3:
						h = atoi( argv[arg]+1 );
						break;
					case 4:
						g.show_time = atoi( argv[arg]+1 );
						break;
					case 5:
						g.fade_in = atoi( argv[arg]+1 );
						break;
					}
					state++;
				}
			}
			else
			{
				Image x = LoadImageFile( argv[arg] );
				if( x )
				{
					g.nImages++;
					AddLink( &g.images, x );
				}
			}
		}
	}

	if( g.nImages )
	{
		g.displays[0] = OpenDisplaySizedAt( DISPLAY_ATTRIBUTE_LAYERED|DISPLAY_ATTRIBUTE_CHILD|DISPLAY_ATTRIBUTE_NO_MOUSE|DISPLAY_ATTRIBUTE_NO_AUTO_FOCUS
													 , w //width
													 , h //height
													 , x //0
													 , y //0
													 );
		g.displays[1] = OpenDisplaySizedAt( DISPLAY_ATTRIBUTE_LAYERED|DISPLAY_ATTRIBUTE_CHILD|DISPLAY_ATTRIBUTE_NO_MOUSE|DISPLAY_ATTRIBUTE_NO_AUTO_FOCUS
													 , w //width
													 , h //height
													 , x //0
													 , y //0
													 );

		SetRedrawHandler( g.displays[0], Output, 0 );
		SetRedrawHandler( g.displays[1], Output, 1 );

		if( g.nImages > 1 )
		{
			target_in_start = GetTickCount();
			AddTimer( 33, tick, 0 );
		}
		else
		{
			//lprintf( "Show the first and only the first image." );
			g.is_up[0] = 1;
			RestoreDisplay( g.displays[0] );
			UpdateDisplay( g.displays[0] );
		}

		while( 1 )
			WakeableSleep( 10000 );
	}
	else
	{
	}
	return 0;
}
Beispiel #24
0
/// <summary>
/// Load configuration from file
/// </summary>
/// <returns>Error code</returns>
DWORD MainDlg::LoadConfig( const std::wstring& path /*= L""*/ )
{
    auto& cfg = _profileMgr.config();
    if (_profileMgr.Load( path ))
    {
        // Image
        for (auto& path : cfg.images)
            LoadImageFile( path );

        // Process
        if (!cfg.procName.empty())
        {
            if (cfg.processMode != Existing)
            {
                SetActiveProcess( 0, cfg.procName );
            }
            else
            {
                std::vector<DWORD> pidList;
                blackbone::Process::EnumByName( cfg.procName, pidList );

                if (!pidList.empty())
                {
                    auto idx = _procList.Add( cfg.procName + L" (" + std::to_wstring( pidList.front() ) + L")", pidList.front() );
                    _procList.selection( idx );

                    SetActiveProcess( pidList.front(), cfg.procName );
                }
            }
        }

        // Process mode
        _exProc.checked( false );
        _newProc.checked( false );
        _autoProc.checked( false );
        switch (cfg.processMode)
        {
            case Existing:
                _exProc.checked( true );
                break;
            case NewProcess:
                _newProc.checked( true );
                break;
            case ManualLaunch:
                _autoProc.checked( true );
                break;
        }

        // Fix injection method
        if (cfg.injectMode >= Kernel_Thread && !blackbone::Driver().loaded())
            cfg.injectMode = Normal;

        // Update profile name
        if (!_defConfig.empty())
            _status.SetText( 0, blackbone::Utils::StripPath( _defConfig ) );
    }
    // Default settings
    else
    {
        _exProc.checked( true );
    }

    UpdateInterface();
    return ERROR_SUCCESS;
}
Beispiel #25
0
HBITMAP CImage::SimpleOpen( CString filename )
{
    // 指定されたファイル名の画像ファイルを読み、ビットマップを生成する
    return LoadImageFile( filename );
}
Beispiel #26
0
void K9S1208_Program(void)
{
    int i;
    int programError=0;
    U32 blockIndex;
    int noLoad=0;
    U8 spareBuf[16]=
	{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
    U8 *srcPt;
    U32 progSize=0;

    printf("\n[SMC(K9S1208V0M) NAND Flash Writing Program]\n");
    
    printf("\nSource size:0h~%xh\n",imageSize-1);
    printf("\nAvailable target block number: 0~4095\n");
    printf("Input target block number:");
    scanf("%d",&targetBlock);
    targetSize=((imageSize+0x4000-1)/0x4000)*0x4000;
    printf("target start block number     =%d\n",targetBlock);
    printf("target size        (0x4000*n) =0x%x\n",targetSize);
    printf("STATUS:");
    blockIndex=targetBlock;
    while(1)
    {
	static j = 0;
	if(noLoad==0)
	{
	    LoadImageFile(blockBuf,0x4000);
	}
	noLoad=0;
	
#if BAD_CHECK       
	if(NF_IsBadBlock(blockIndex) && blockIndex!=0 )	// 1:bad 0:good
        {
	    blockIndex++;   // for next block
	    noLoad=1;
	    continue;
	}
#endif
	if(!NF_EraseBlock(blockIndex))
	{
	    blockIndex++;   // for next block
	    noLoad=1;
	    continue;
	}

	printf("\n");
	srcPt=blockBuf;

	for(i=0;i<32;i++)
	{
	    if(!NF_WritePage(blockIndex,i,srcPt,NULL/*spareBuf*/))// block num, page num, buffer
	    {
	        programError=1;
	        break;
	    }

	    srcPt+=512;	// Increase buffer addr one pase size
	    printf("\rE:(%d/%d)",32*j+i,32 * targetSize / 0x4000);
	    fflush(stdout); 
	}
	j++;
	printf("\n");

        if(programError==1)
	{
	    blockIndex++;
	    noLoad=1;
	    programError=0;
	    continue;
	}
	progSize+=0x4000;
	if(progSize>=imageSize)
	    break;	// Exit while loop
	blockIndex++;
    }
}
Beispiel #27
0
int InitImage( PSENTIENT ps, PENTITY pe, PTEXT parameters )
{
	INDEX idx;
	for( idx = 0; idx < NUM_IMAGE_VARS; idx++ )
	{
      PTEXT saveparms = parameters;
		PTEXT arg;
		Image parent = GetLink( &FindContainer( pe )->pPlugin, iImage );
		arg = GetParam( ps, &parameters );
		if( IsNumber( arg ) )
		{
			PTEXT arg2 = GetParam( ps, &parameters );
			if( IsNumber( arg2 ) )
			{
            Image image;
				if( parent )
					image = MakeSubImage( parent
											  , 0, 0 // need other 2 arguments.
											  , atoi( GetText( arg ) )
											  , atoi( GetText( arg2 ) )
											  );
            else
					image = MakeImageFile( atoi( GetText( arg ) )
													, atoi( GetText( arg2 ) ) );
				SetLink( &pe->pPlugin, iImage, image );
				if( ps->CurrentMacro )
					ps->CurrentMacro->state.flags.bSuccess = TRUE;
				else
				{
					DECLTEXT( msg, "Invalid second parameter, expecting a number" );
               EnqueLink( &ps->Command->Output, &msg );
				}
				// if more args - warn?
			}
		}
		else
		{
         Image image;
			// expect that the remainder is a name..
			parameters = saveparms;
			arg = GetFileName( ps, &parameters );
         // loaded image file doesn't care for parent status...
			image = LoadImageFile( GetText( arg ) );
			if( image )
			{
				SetLink( &pe->pPlugin, iImage, image );
				if( ps->CurrentMacro )
					ps->CurrentMacro->state.flags.bSuccess = TRUE;
				else
				{
					DECLTEXT( msg, "Failed to load image..." );
               EnqueLink( &ps->Command->Output, &msg );
				}
			}
		}
		AddVolatileVariable( pe, ImageVars + idx, 0 );
		{
			int n;
			for( n = 0; n < NUM_METHODS; n++ )
            AddMethod( pe, ImageMethods + n );
		}

	}
	return 0; // return success
}
Beispiel #28
0
	static uintptr_t CPROC SetScoreboardStatic( uintptr_t psv, arg_list args )
{
	PARAM( args, CTEXTSTR, name );	ffl.scoreboard.static_image = LoadImageFile( name );	return psv;
}
Beispiel #29
0
	CGameWindow()
		: CFKWindow( 250,400,false )
		, m_Font( Graphics(), FK2DEngine::DefaultFontName(), 20 )
	{
		SetCaption( L"自由骑士笃志引擎:DEMO3 UI测试" );
		SetBackgroudColor( FK2DEngine::CColor::BLUE );

		std::wstring szFileName = L"";

		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc\\media\\Panel.bmp";
		m_UIPanelImage = LoadImageFile( szFileName );
		m_Panel.Create( SSGUIManager::Instance()->GetRootCtrl(), 
			( GetScreenWidth() - m_UIPanelImage.Width() ) / 2 , 40, m_UIPanelImage );

		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc\\media\\PicButton.bmp";
		m_UIButtonImage = LoadImageFile( szFileName );
		m_pColor = (new CColor( CColor::GREEN ));
		m_Button.SetFontColor( *m_pColor );
		m_Button.Create( SSGUIManager::Instance()->GetRootCtrl(), 
			( GetScreenWidth() - m_UIButtonImage.Width() / 4 ) / 2 , 60, m_UIButtonImage, L"测试按钮" );

		m_pLable.Create( SSGUIManager::Instance()->GetRootCtrl(), 
			40, 13, L"● Lable控件" );

		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc\\media\\Checkbox.bmp";
		m_UICheckBoxImage = LoadImageFile( szFileName );
		m_CheckBox.SetFont( m_Font );
		m_CheckBox.Create( SSGUIManager::Instance()->GetRootCtrl(), 
			( GetScreenWidth() - m_UICheckBoxImage.Width() / 6 - m_Font.TextWidth(L"测试复选框") - 10 ) / 2, 110, m_UICheckBoxImage, L"测试复选框" );


		m_Form.Create( SSGUIManager::Instance()->GetRootCtrl(), ( GetScreenWidth() - m_UIPanelImage.Width() ) / 2, 165 , m_UIPanelImage );
		RECT rc;
		rc.left = 0;
		rc.top = 0;
		rc.right = m_UIPanelImage.Width();
		rc.bottom = m_UIPanelImage.Height();
		m_Form.SetHotRect( rc );
		m_Form.SetZPos( FK2DEngine::eDZP_UIBegin + 2 );
		// 加入响应消息处理
		SSGUIManager::Instance()->AddCtrl( &m_Form );

		m_Radio1.SetFont( m_Font );
		m_Radio2.SetFont( m_Font );
		m_Radio1.SetGroup( 1 );
		m_Radio2.SetGroup( 1 );
		m_Radio1.Create( (FK2DEngine::IGUIControl *)(&m_Form), 5, 5, m_UICheckBoxImage, L"单选框组1" );
		m_Radio2.Create( (FK2DEngine::IGUIControl *)(&m_Form), 5, 33, m_UICheckBoxImage, L"单选框组1" );

		m_Radio3.SetFont( m_Font );
		m_Radio4.SetFont( m_Font );
		m_Radio3.Create( (FK2DEngine::IGUIControl *)(&m_Form), 5, 61, m_UICheckBoxImage, L"单选框组2" );
		m_Radio3.SetGroup( 2 );
		m_Radio3.SetFontColor( *m_pColor );
		m_Radio4.Create( (FK2DEngine::IGUIControl *)(&m_Form), 5, 89, m_UICheckBoxImage, L"单选框组2" );
		m_Radio4.SetGroup( 2 );
		m_Radio4.SetFontColor( *m_pColor );

		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc\\media\\slot.bmp";
		m_UIScrollBackImage = LoadImageFile( szFileName );
		m_pImageCtrl.Create( SSGUIManager::Instance()->GetRootCtrl(), 10, 310, m_UIScrollBackImage );
		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc\\media\\slider.bmp";
		m_UIScrollImage = LoadImageFile( szFileName );
		m_pScrollBar.Create( SSGUIManager::Instance()->GetRootCtrl(), 17, 310, ESBT_Horizontal, m_UIScrollImage, m_UIScrollImage.Width() );

		szFileName = FK2DEngine::ShareResourcePrefix() + L"rc\\media\\edit.bmp";
		m_UIEditImage = LoadImageFile( szFileName );
		m_pEditBack.Create( SSGUIManager::Instance()->GetRootCtrl(), 10, 340, m_UIEditImage );
		m_pEdit.Create( SSGUIManager::Instance()->GetRootCtrl(), 35, 348, 200 );
		m_pEdit.SetFocus();
/*
		ON_KEYPRESS( &m_CheckBox, CCheckBox1Press );
*/

		szFileName = FK2DEngine::ShareResourcePrefix() + L"avgRc\\Attack.cur";
		SetNewCursor( szFileName );
	}
Beispiel #30
0
void File2Gbuf(char *str, int adr)
{
	if(adr > 0x80000)
		adr = 0;
	LoadImageFile(str, gTransferBuf + adr, 0x80000 - adr);
}