MAMEWorld >> Programming
Index   Flat Mode Flat  

ole
MAME Porter
Reged: 02/09/14
Posts: 19
Send PM
Re: Mame scaling help
02/19/14 01:39 AM


Hi,

I'm not a windows expert but looking at the code you provided the entry code for drawing is the function on line 812: draw_video_contents().
In that function there is a selection of technique that will be used to draw/scale the bitmap on the screen / your window. There's 3 ways how to draw in that function:
- either use Direct 3D - which uses 3D graphics (polygons and textures) to draw/stretch the original mame_bitmap. It calls win_d3d_draw(...) function to do it.
- or use DirectDraw - which s probably the accelerated 2D rendering using the DirectDraw api. It calls win_ddraw_draw(...) function to do it.
- finally there is some compatible (probably less optimized) way how to draw usig some DIB api. It calls dib_draw_window(...) function to do it.

I would suggest to try the last option first. To run that code path make sure you disable direct3D and direct draw rendering (probably in your mame.cfg /.ini file).
Look at the function dib_draw_window(...) on line 1661 and put some trace there (printf("I'm here!\n");) to make sure the function is being called. Then look at the line 1740: StretchDIBits(...) - and the comment above it (Look! in the code line 1739 it states that is the actual stretching code!). Google the function name and you will find the parameters:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145121%28v=vs.85%29.aspx

int StretchDIBits(
_In_ HDC hdc,
_In_ int XDest,
_In_ int YDest,
_In_ int nDestWidth,
_In_ int nDestHeight,
_In_ int XSrc,
_In_ int YSrc,
_In_ int nSrcWidth,
_In_ int nSrcHeight,
_In_ const VOID *lpBits,
_In_ const BITMAPINFO *lpBitsInfo,
_In_ UINT iUsage,
_In_ DWORD dwRop
);


The interesting parameter is the "nDestWidth" which is probably the destination width. Try to change it - let's say put there your window width (1280) and see wheter it will have any effect. If it won't work or if it crashes make the value smaller and test it again. Experiemnt with the value. You will notice it will probably stretch the image, but the left black bar will still be there. Now try to modify the XDest parameter which is probably the destination X posititon. Try to change it to 0 and see the effect.
Hope it helps.







Entire thread
Subject Posted by Posted on
* Mame scaling help TheElf 02/17/14 04:47 PM
. * Re: Mame scaling help krick  02/19/14 04:55 AM
. * Re: Mame scaling help TheElf  02/19/14 03:39 PM
. * Re: Mame scaling help ole  02/19/14 01:39 AM
. * Re: Mame scaling help TheElf  02/19/14 03:27 AM
. * Re: Mame scaling help ole  02/19/14 10:45 PM
. * Re: Mame scaling help R. Belmont  02/18/14 05:50 PM
. * Re: Mame scaling help TheElf  02/18/14 06:24 PM

Extra information Permissions
Moderator:  Pi 
0 registered and 50 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 3832