示例#1
0
static void onSizing(HWND, WPARAM wParam, LPARAM lParam)
{
    RECT* rect = (RECT *)lParam;
    int adjustment = wParam;
    int extrawidth = getScrnExtraWidth();
    int extraheight = getScrnExtraHeight();
    int adjwidth, adjheight;
    int nBmapWidth = nVidImageWidth, nBmapHeight = nVidImageHeight;

    // get game size
    if (bDrvOkay) {
        if ((BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) && (nVidRotationAdjust & 1)) {
            BurnDrvGetVisibleSize(&nBmapHeight, &nBmapWidth);
        } else {
            BurnDrvGetVisibleSize(&nBmapWidth, &nBmapHeight);
        }

        if (nBmapWidth <= 0 || nBmapHeight <= 0) {
            return;
        }
    }

    RECT rect_image = {
        0, 0, rect->right-rect->left-extrawidth, rect->bottom-rect->top-extraheight
    };
    VidScale(&rect_image, nBmapWidth, nBmapHeight);

    // calculate screen size to fit game size
    adjwidth = rect->left + rect_image.right - rect_image.left + extrawidth - rect->right;
    adjheight = rect->top + rect_image.bottom - rect_image.top + extraheight - rect->bottom;

    switch (adjustment)
    {
    case WMSZ_BOTTOM:
    case WMSZ_BOTTOMRIGHT:
    case WMSZ_RIGHT:
        rect->right += adjwidth;
        rect->bottom += adjheight;
        break;

    case WMSZ_BOTTOMLEFT:
        rect->left -= adjwidth;
        rect->bottom += adjheight;
        break;

    case WMSZ_LEFT:
    case WMSZ_TOPLEFT:
    case WMSZ_TOP:
        rect->left -= adjwidth;
        rect->top -= adjheight;
        break;

    case WMSZ_TOPRIGHT:
        rect->right += adjwidth;
        rect->top -= adjheight;
        break;
    }
}
示例#2
0
void K053247Init(UINT8 *gfxrom, INT32 gfxlen, void (*Callback)(INT32 *code, INT32 *color, INT32 *priority), INT32 flags)
{
	K053247Ram = (UINT8*)BurnMalloc(0x1000);

	K053246Gfx = gfxrom;
	K053246Mask = gfxlen;

	K053247Callback = Callback;

	K053247_dx = 0;
	K053247_dy = 0;
	K053247_wraparound = 1;

	if (konami_temp_screen == NULL) {
		INT32 width, height;
		BurnDrvGetVisibleSize(&width, &height);
		konami_temp_screen = (UINT16*)BurnMalloc(width * height * 2);
	}

	K053247Temp = konami_temp_screen;

	K053247Flags = flags; // 0x02 highlight, 0x01 shadow

	KonamiIC_K053247InUse = 1;
}
示例#3
0
void BurnGunInit(int nNumPlayers, bool bDrawTargets)
{
	if (nNumPlayers > MAX_GUNS) nNumPlayers = MAX_GUNS;
	nBurnGunNumPlayers = nNumPlayers;
	bBurnGunDrawTargets = bDrawTargets;
	
	if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
		BurnDrvGetVisibleSize(&nBurnGunMaxY, &nBurnGunMaxX);
	} else {
		BurnDrvGetVisibleSize(&nBurnGunMaxX, &nBurnGunMaxY);
	}
	
	for (int i = 0; i < MAX_GUNS; i++) {
		BurnGunX[i] = ((nBurnGunMaxX / 2) - 7) << 8;
		BurnGunY[i] = ((nBurnGunMaxY / 2) - 8) << 8;
	}
}
示例#4
0
static int Init()
{
	bRotateGame = (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL);
	bFlipGame = BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED;

	if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
		BurnDrvGetVisibleSize(&clipy, &clipx);
		BurnDrvGetFullSize(&sizex, &sizey);
	} else {
		BurnDrvGetVisibleSize(&clipx, &clipy);
		BurnDrvGetFullSize(&sizex, &sizey);
	}
   	VidBpp		= nBurnBpp = 2;
	VidMemPitch	= sizex * VidBpp;
	VidMemLen	= sizey * VidMemPitch;
	VidMem = (unsigned char*)malloc(VidMemLen);
	SetBurnHighCol(16);
	bVidScanlines = 0;								// !!!
	nVidFullscreen=0;
	vidgu_init();
	return 0;
}
示例#5
0
文件: sshot.cpp 项目: hhhanzo/fbarr
unsigned char* ConvertVidImage(int bFlipVertical)
{
    unsigned char* pImage = pVidImage;
    unsigned char* pTemp = NULL;
    int w, h;

    BurnDrvGetVisibleSize(&w, &h);

    // Convert the image to 32-bit
    if (nVidImageBPP < 4) {
        pTemp = (unsigned char*)malloc(w * h * sizeof(int));

        if (nVidImageBPP == 2) {
            for (int i = 0; i < h * w; i++) {
                unsigned short nColour = ((unsigned short*)pImage)[i];

                // Red
                *(pTemp + i * 4 + 0) = (unsigned char)((nColour & 0x1F) << 3);
                *(pTemp + i * 4 + 0) |= *(pTemp + 4 * i + 0) >> 5;

                if (nVidImageDepth == 15) {
                    // Green
                    *(pTemp + i * 4 + 1) = (unsigned char)(((nColour >> 5) & 0x1F) << 3);
                    *(pTemp + i * 4 + 1) |= *(pTemp + i * 4 + 1) >> 5;
                    // Blue
                    *(pTemp + i * 4 + 2) = (unsigned char)(((nColour >> 10)& 0x1F) << 3);
                    *(pTemp + i * 4 + 2) |= *(pTemp + i * 4 + 2) >> 5;
                }

                if (nVidImageDepth == 16) {
                    // Green
                    *(pTemp + i * 4 + 1) = (unsigned char)(((nColour >> 5) & 0x3F) << 2);
                    *(pTemp + i * 4 + 1) |= *(pTemp + i * 4 + 1) >> 6;
                    // Blue
                    *(pTemp + i * 4 + 2) = (unsigned char)(((nColour >> 11) & 0x1F) << 3);
                    *(pTemp + i * 4 + 2) |= *(pTemp + i * 4 + 2) >> 5;
                }
            }
示例#6
0
int scrnSize()
{
    if (!hScrnWnd || nVidFullscreen || bFakeFullscreen) {
        return 1;
    }

    int nBmapWidth = nVidImageWidth, nBmapHeight = nVidImageHeight;
    int nGameAspectX = 4, nGameAspectY = 3;

    // adjust the screen size for skin, added by regret
    if (!bDrvOkay) {
        if (nBmapWidth > DEFAULT_IMAGE_WIDTH) {
            nBmapWidth = DEFAULT_IMAGE_WIDTH;
        }
        if (nBmapHeight > DEFAULT_IMAGE_HEIGHT) {
            nBmapHeight = DEFAULT_IMAGE_HEIGHT;
        }
    }

    if (bDrvOkay) {
        if ((BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) && (nVidRotationAdjust & 1)) {
            BurnDrvGetVisibleSize(&nBmapHeight, &nBmapWidth);
            BurnDrvGetAspect(&nGameAspectY, &nGameAspectX);
        } else {
            BurnDrvGetVisibleSize(&nBmapWidth, &nBmapHeight);
            BurnDrvGetAspect(&nGameAspectX, &nGameAspectY);
        }

        if (nBmapWidth <= 0 || nBmapHeight <= 0) {
            return 1;
        }
    }

    nDragX = GetSystemMetrics(SM_CXDRAG) / 2;
    nDragY = GetSystemMetrics(SM_CYDRAG) / 2;

    // Find the size of the visible WorkArea
    SystemParametersInfo(SPI_GETWORKAREA, 0, &SystemWorkArea, 0);

    int nScrnWidth = SystemWorkArea.right - SystemWorkArea.left;
    int nScrnHeight = SystemWorkArea.bottom - SystemWorkArea.top;

    int nMaxSize = nWindowSize;

    if (nMaxSize <= 0) {
        // auto size
        if (nBmapWidth < nBmapHeight) {
            if (nScrnHeight <= 600) {
                nMaxSize = 1;
            }
            else if (nScrnHeight <= 960) {
                nMaxSize = 2;
            }
            else if (nScrnHeight <= 1280) {
                nMaxSize = 3;
            }
            else {
                nMaxSize = 4;
            }
        } else {
            if (nScrnWidth <= 640) {
                nMaxSize = 1;
            }
            else if (nScrnWidth <= 1152) {
                nMaxSize = 2;
            }
            else if (nScrnWidth <= 1600) {
                nMaxSize = 3;
            }
            else {
                nMaxSize = 4;
            }
        }
    }

    // Find the width and height
    int w = nScrnWidth;
    int h = nScrnHeight;

    // Find out how much space is taken up by the borders
    int ew = getScrnExtraWidth();
    int eh = getScrnExtraHeight();

    if (bMenuEnabled) {
        // Subtract the border space
        w -= ew;
        h -= eh;
    }

    if (bVidCorrectAspect || bVidFullStretch) {
        int ww = w;
        int hh = h;

        do {
            if (nBmapWidth < nBmapHeight) {
                if (ww > nBmapWidth * nMaxSize) {
                    ww = nBmapWidth * nMaxSize;
                }
                if (hh > ww * vidScrnAspect * nGameAspectY * nScrnHeight / (nScrnWidth * nGameAspectX)) {
                    hh = ww * vidScrnAspect * nGameAspectY * nScrnHeight / (nScrnWidth * nGameAspectX);
                }
            } else {
                if (hh > nBmapHeight * nMaxSize) {
                    hh = nBmapHeight * nMaxSize;
                }
                if (ww > hh * nGameAspectX * nScrnWidth / (nScrnHeight * vidScrnAspect * nGameAspectY)) {
                    ww = hh * nGameAspectX * nScrnWidth / (nScrnHeight * vidScrnAspect * nGameAspectY);
                }
            }
        } while ((ww > w || hh > h) && nMaxSize-- > 1);
        w =	ww;
        h = hh;
    } else {
        while ((nBmapWidth * nMaxSize > w || nBmapHeight * nMaxSize > h) && nMaxSize > 1) {
            nMaxSize--;
        }

        if (w > nBmapWidth * nMaxSize || h > nBmapHeight * nMaxSize) {
            w = nBmapWidth * nMaxSize;
            h = nBmapHeight * nMaxSize;
        }
    }

    RECT rect = { 0, 0, w, h };
    VidScale(&rect, nBmapWidth, nBmapHeight);
    w = rect.right - rect.left + ew;
    h = rect.bottom - rect.top + eh;

    int x = nWindowPosX;
    int y = nWindowPosY;
    if (x + w > SystemWorkArea.right || y + h > SystemWorkArea.bottom) {
        // Find the midpoint for the window
        x = SystemWorkArea.left + SystemWorkArea.right;
        x /= 2;
        y = SystemWorkArea.bottom + SystemWorkArea.top;
        y /= 2;

        x -= w / 2;
        y -= h / 2;
    }

    bMaximised = false;

    MoveWindow(hScrnWnd, x, y, w, h, TRUE);
//	SetWindowPos(hScrnWnd, NULL, x, y, w, h, SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOZORDER);
    if (bDrvOkay && bShowOnTop) {
        SetWindowPos(hScrnWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOMOVE);
    }

    nWindowPosX = x;
    nWindowPosY = y;

    return 0;
}
示例#7
0
static void set_led_draw_position()
{
	led_position = led_position0;

	if (screen_flipped ^ flipscreen) {
		switch (led_position & 3) {
			case LED_POSITION_TOP_LEFT: led_position = LED_POSITION_BOTTOM_RIGHT; break;
			case LED_POSITION_TOP_RIGHT: led_position = LED_POSITION_BOTTOM_LEFT; break;
			case LED_POSITION_BOTTOM_LEFT: led_position = LED_POSITION_TOP_RIGHT; break;
			case LED_POSITION_BOTTOM_RIGHT: led_position = LED_POSITION_TOP_LEFT; break;
		}
	}

	if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
		BurnDrvGetVisibleSize(&nScreenHeight, &nScreenWidth);

		led_xadv = 0;
		led_yadv = led_size + 1;
	
		switch (led_position & 3)
		{
			case LED_POSITION_TOP_LEFT:
				led_xpos = (nScreenWidth - 1) - led_size;
				led_ypos = 1;
			break;

			case LED_POSITION_BOTTOM_RIGHT:
				led_xpos = 1;
				led_ypos = (nScreenHeight - 1) - (led_yadv * led_count);
			break;

			case LED_POSITION_BOTTOM_LEFT:
				led_xpos = 1;
				led_ypos = 1;
			break;

			case LED_POSITION_TOP_RIGHT:
			default:
				led_xpos = (nScreenWidth  - 1) - led_size;
				led_ypos = (nScreenHeight - 1) - (led_yadv * led_count);
			break;
		}
	} else {
		BurnDrvGetVisibleSize(&nScreenWidth, &nScreenHeight);

		led_xadv = led_size + 1;
		led_yadv = 0;
	
		switch (led_position & 3)
		{
			case LED_POSITION_BOTTOM_LEFT:
				led_xpos = 1;
				led_ypos = (nScreenHeight - 1) - led_size;
//				led_ypos;
			break;

			case LED_POSITION_TOP_RIGHT:
				led_xpos = (nScreenWidth - 1) - (led_xadv * led_count);
				led_ypos = 1;
			break;

			case LED_POSITION_TOP_LEFT:
				led_xpos = 1;
				led_ypos = 1;
			break;

			case LED_POSITION_BOTTOM_RIGHT:
			default:
				led_xpos = (nScreenWidth  - 1) - (led_xadv * led_count);
				led_ypos = (nScreenHeight - 1) - led_size;
			break;
		}
	}
}
static int Init()
{
	nInitedSubsytems = SDL_WasInit(SDL_INIT_VIDEO);

	if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
		SDL_InitSubSystem(SDL_INIT_VIDEO);
	}

	nGamesWidth = nVidImageWidth;
	nGamesHeight = nVidImageHeight;

	nRotateGame = 0;

	if (bDrvOkay) {
		// Get the game screen size
		BurnDrvGetVisibleSize(&nGamesWidth, &nGamesHeight);

		if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
			printf("Vertical\n");
			nRotateGame = 1;
		}

		if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
			printf("Flipped\n");
			bFlipped = true;
		} 
	}

	if (!nRotateGame) {
		nTextureWidth = GetTextureSize(nGamesWidth);
		nTextureHeight = GetTextureSize(nGamesHeight);
	} else {
		nTextureWidth = GetTextureSize(nGamesHeight);
		nTextureHeight = GetTextureSize(nGamesWidth);
	}

	nSize = 2;
	bVidScanlines = 0;

	RECT test_rect;
	test_rect.left = 0;
	test_rect.right = nGamesWidth;
	test_rect.top = 0;
	test_rect.bottom = nGamesHeight;

	printf("correctx before %d, %d\n", test_rect.right, test_rect.bottom);
	VidSScaleImage(&test_rect);
	printf("correctx after %d, %d\n", test_rect.right, test_rect.bottom);

	screen = SDL_SetVideoMode(test_rect.right * nSize,
				  test_rect.bottom * nSize, 32, SDL_OPENGL);
	SDL_WM_SetCaption("FB Alpha", NULL);

	// Initialize the buffer surfaces
	BlitFXInit();

	// Init opengl
	init_gl();

	return 0;
}
示例#9
0
INT32 MakeScreenShot()
{
    char szAuthor[256];
    char szDescription[256];
    char szCopyright[256];
    char szSoftware[256];
    char szSource[256];
    png_text text_ptr[8] = { { 0, 0, 0, 0, 0, 0, 0 }, };
    INT32 num_text = 8;

    time_t currentTime;
    tm* tmTime;
    png_time_struct png_time_now;

    char szSShotName[MAX_PATH];
    INT32 w, h;

    // do our PNG construct things
    png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    if (!png_ptr) {
        return SSHOT_LIBPNG_ERROR;
    }

    png_infop info_ptr = png_create_info_struct(png_ptr);
    if (!info_ptr) {
        png_destroy_write_struct(&png_ptr, (png_infopp)NULL);

        return SSHOT_LIBPNG_ERROR;
    }

    if (setjmp(png_jmpbuf(png_ptr))) {
        png_destroy_write_struct(&png_ptr, &info_ptr);
        if (pConvertedImage) {
            free(pConvertedImage);
            pConvertedImage = NULL;
        }

        if (pSShotImageRows) {
            free(pSShotImageRows);
            pSShotImageRows = NULL;
        }

        fclose(ff);
        remove(szSShotName);

        return SSHOT_LIBPNG_ERROR;
    }

    if (pVidImage == NULL) {
        return SSHOT_OTHER_ERROR;
    }

    if (nVidImageBPP < 2 || nVidImageBPP > 4) {
        return SSHOT_ERROR_BPP_NOTSUPPORTED;
    }

    BurnDrvGetVisibleSize(&w, &h);

    pSShot = pVidImage;

    // Convert the image to 32-bit
    if (nVidImageBPP < 4) {
        UINT8* pTemp = (UINT8*)malloc(w * h * sizeof(INT32));

        if (nVidImageBPP == 2) {
            for (INT32 i = 0; i < h * w; i++) {
                UINT16 nColour = ((UINT16*)pSShot)[i];

                // Red
                *(pTemp + i * 4 + 0) = (UINT8)((nColour & 0x1F) << 3);
                *(pTemp + i * 4 + 0) |= *(pTemp + 4 * i + 0) >> 5;

                if (nVidImageDepth == 15) {
                    // Green
                    *(pTemp + i * 4 + 1) = (UINT8)(((nColour >> 5) & 0x1F) << 3);
                    *(pTemp + i * 4 + 1) |= *(pTemp + i * 4 + 1) >> 5;
                    // Blue
                    *(pTemp + i * 4 + 2) = (UINT8)(((nColour >> 10)& 0x1F) << 3);
                    *(pTemp + i * 4 + 2) |= *(pTemp + i * 4 + 2) >> 5;
                }

                if (nVidImageDepth == 16) {
                    // Green
                    *(pTemp + i * 4 + 1) = (UINT8)(((nColour >> 5) & 0x3F) << 2);
                    *(pTemp + i * 4 + 1) |= *(pTemp + i * 4 + 1) >> 6;
                    // Blue
                    *(pTemp + i * 4 + 2) = (UINT8)(((nColour >> 11) & 0x1F) << 3);
                    *(pTemp + i * 4 + 2) |= *(pTemp + i * 4 + 2) >> 5;
                }
            }
示例#10
0
int ProcessCmdLine()
{
	unsigned int i;
	int nOptX = 0, nOptY = 0, nOptD = 0;
	int nOpt1Size;
	TCHAR szOpt2[3] = _T("");
	TCHAR szName[MAX_PATH];

	if (szCmdLine[0] == _T('\"')) {
		int nLen = _tcslen(szCmdLine);
		nOpt1Size = 1;
		while (szCmdLine[nOpt1Size] != _T('\"') && nOpt1Size < nLen) {
			nOpt1Size++;
		}
		if (nOpt1Size == nLen) {
			szName[0] = 0;
		} else {
			nOpt1Size++;
			_tcsncpy(szName, szCmdLine + 1, nOpt1Size - 2);
			szName[nOpt1Size - 2] = 0;
		}
	} else {
		int nLen = _tcslen(szCmdLine);
		nOpt1Size = 0;
		while (szCmdLine[nOpt1Size] != _T(' ') && nOpt1Size < nLen) {
			nOpt1Size++;
		}
		_tcsncpy(szName, szCmdLine, nOpt1Size);
		szName[nOpt1Size] = 0;
	}

	if (_tcslen(szName)) {
		if (_tcscmp(szName, _T("-listinfo")) == 0) {
			write_datfile(0, 0, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listinfowithmd")) == 0) {
			write_datfile(0, 1, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listinfomdonly")) == 0) {
			write_datfile(0, 2, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listextrainfo")) == 0) {
			int nWidth;
			int nHeight;
			int nAspectX;
			int nAspectY;
			for (i = 0; i < nBurnDrvCount; i++) {
				nBurnDrvSelect = i;
				BurnDrvGetVisibleSize(&nWidth, &nHeight);
				BurnDrvGetAspect(&nAspectX, &nAspectY);
				printf("%s\t%ix%i\t%i:%i\t0x%08X\t\"%s\"\t%i\t%i\t%x\t%x\t\"%s\"\n", BurnDrvGetTextA(DRV_NAME), nWidth, nHeight, nAspectX, nAspectY, BurnDrvGetHardwareCode(), BurnDrvGetTextA(DRV_SYSTEM), BurnDrvIsWorking(), BurnDrvGetMaxPlayers(), BurnDrvGetGenreFlags(), BurnDrvGetFamilyFlags(), BurnDrvGetTextA(DRV_COMMENT));
			}			
			return 1;
		}
	}

	_stscanf(&szCmdLine[nOpt1Size], _T("%2s %i x %i x %i"), szOpt2, &nOptX, &nOptY, &nOptD);

	if (_tcslen(szName)) {
		bool bFullscreen = 1;
		bCmdOptUsed = 1;

		if (_tcscmp(szOpt2, _T("-r")) == 0) {
			if (nOptX && nOptY) {
				nVidWidth = nOptX;
				nVidHeight = nOptY;
			}
			if (nOptD) {
				nVidDepth = nOptD;
			}
		} else {
			if (_tcscmp(szOpt2, _T("-a")) == 0) {
				bVidArcaderes = 1;
			} else {
				if (_tcscmp(szOpt2, _T("-w")) == 0) {
					bCmdOptUsed = 0;
					bFullscreen = 0;
				}
			}
		}

		if (bFullscreen) {
			nVidFullscreen = 1;
		}

		if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fs")) == 0) {
			if (BurnStateLoad(szName, 1, &DrvInitCallback)) {
				return 1;
			} else {
//				bRunPause = 1;
			}
		} else {
			if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fr")) == 0) {
				if (StartReplay(szName)) {
					return 1;
				}
			} else {
				for (i = 0; i < nBurnDrvCount; i++) {
					nBurnDrvSelect = i;
					if (_tcscmp(BurnDrvGetText(DRV_NAME), szName) == 0) {
						MediaInit();
						DrvInit(i, true);
						break;
					}
				}
				if (i == nBurnDrvCount) {
					FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_NOSUPPORT), szName, _T(APP_TITLE));
					FBAPopupDisplay(PUF_TYPE_ERROR);
					return 1;
				}
			}
		}
	}

	POST_INITIALISE_MESSAGE;

	if (!nVidFullscreen) {
		MenuEnableItems();
	}

	return 0;
}
示例#11
0
static int Init()
{
    nInitedSubsytems = SDL_WasInit(SDL_INIT_VIDEO);

    if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
        SDL_InitSubSystem(SDL_INIT_VIDEO);
    }

    nUseBlitter = nVidBlitterOpt[nVidSelect] & 0xFF;

    nGameWidth = nVidImageWidth;
    nGameHeight = nVidImageHeight;

    nRotateGame = 0;
    if (bDrvOkay) {
        // Get the game screen size
        BurnDrvGetVisibleSize(&nGameWidth, &nGameHeight);

        if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
            if (nVidRotationAdjust & 1) {
                int n = nGameWidth;
                nGameWidth = nGameHeight;
                nGameHeight = n;
                nRotateGame |= (nVidRotationAdjust & 2);
            } else {
                nRotateGame |= 1;
            }
        }

        if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
            nRotateGame ^= 2;
        }
    }

    nSize = VidSoftFXGetZoom(nUseBlitter);
    bVidScanlines = 0;								// !!!

    if (nVidFullscreen) {

        nVidScrnWidth = nVidWidth;
        nVidScrnHeight = nVidHeight;

        if ((sdlsFramebuf = SDL_SetVideoMode(nVidWidth, nVidHeight, nVidDepth, SDL_HWSURFACE | SDL_ANYFORMAT | SDL_DOUBLEBUF | SDL_FULLSCREEN)) == NULL) {
            dprintf(_T("*** Couldn't enter fullscreen mode.\n"));
            return 1;
        }
    } else {
        if ((sdlsFramebuf = SDL_SetVideoMode(nGameWidth * nSize, nGameHeight * nSize, 0, SDL_RESIZABLE | SDL_HWSURFACE)) == NULL) {
            return 1;
        }
    }

    SDL_SetClipRect(sdlsFramebuf, NULL);

    // Initialize the buffer surfaces
    BlitFXInit();

    if (VidSoftFXInit(nUseBlitter, nRotateGame)) {
        if (VidSoftFXInit(0, nRotateGame)) {
            Exit();
            return 1;
        }
    }

    return 0;
}
static int Init()
{
	nInitedSubsytems = SDL_WasInit(SDL_INIT_VIDEO);

	if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
		SDL_InitSubSystem(SDL_INIT_VIDEO);
	}

	nUseBlitter = 0;
	nGameWidth = nVidImageWidth; nGameHeight = nVidImageHeight;
	nRotateGame = 0;
    //nVidRotationAdjust = 1; // add_shin

	if (bDrvOkay) {
		// Get the game screen size
		BurnDrvGetVisibleSize(&nGameWidth, &nGameHeight);

		printf( "vid_sdlfx.Init: nGame: %ix%i", nGameWidth, nGameHeight );

	    if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
			if (nVidRotationAdjust & 1) {
				int n = nGameWidth;
				nGameWidth = nGameHeight;
				nGameHeight = n;
				nRotateGame |= (nVidRotationAdjust & 2);
			} else {
				nRotateGame |= 1;
			}
		}

		if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
			nRotateGame ^= 2;
		}
	}

	nSize = VidSoftFXGetZoom(nUseBlitter);
	bVidScanlines = 0;								// !!!

	if( ( sdlFramebuf = SDL_SetVideoMode(nGameWidth * nSize, nGameHeight * nSize, 0, SDL_RESIZABLE | SDL_HWSURFACE ) ) == NULL )
		return 1;

	printf("android_sdlfx.Init: SDL_SetVideoMode( %i, %i )", nGameWidth * nSize, nGameHeight * nSize );

	printf("android_sdlfx.Init: sdlFramebuf PixelFormat = %s",
				SDL_GetPixelFormatName(
						SDL_MasksToPixelFormatEnum(
								sdlFramebuf->format->BitsPerPixel,
								sdlFramebuf->format->Rmask,
								sdlFramebuf->format->Gmask,
								sdlFramebuf->format->Bmask,
								sdlFramebuf->format->Amask) ) );

	printf("android_sdlfx.Init: ( %i, %u, %u, %u, %u )",
			sdlFramebuf->format->BitsPerPixel,
			sdlFramebuf->format->Rmask,
			sdlFramebuf->format->Gmask,
			sdlFramebuf->format->Bmask,
			sdlFramebuf->format->Amask );

	SDL_SetClipRect(sdlFramebuf, NULL);

	// Initialize the buffer surfaces
	BlitFXInit();

	if (VidSoftFXInit(nUseBlitter, nRotateGame)) {
		if (VidSoftFXInit(0, nRotateGame)) {
			Exit();
			return 1;
		}
	}

	printf( "vid_sdlfx.Init: nRotateGame=%i", nRotateGame );

	return 0;
}