Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: Terry Bogard on June 20, 2005, 01:51:03 pm
-
I want repot MAME 0.96 to Pocket PC, when I ready start artwork, a trouble hitted me
Here's the function at the blit.c...
int win_perform_blit(const struct win_blit_params *blit, int update)
{
...
// copy data to the globals
asmblit_srcdata = (UINT8 *)blit->srcdata + blit->srcpitch * srcy + srcdepth * srcx;
asmblit_srcheight = blit->srcheight;
asmblit_srclookup = blit->srclookup;
asmblit_dstdata = (UINT8 *)blit->dstdata + blit->dstpitch * blit->dstyoffs + dstdepth * blit->dstxoffs;
asmblit_dstpitch = blit->dstpitch;
// pick the blitter
blitter = update ? (blitter_func)active_update_blitter : (blitter_func)active_fast_blitter;
(*blitter)();
...
}
asmblit_xxx defined at asmblit.asm, it's X86 ASM, you konw, ARM CPU can't use it.
So I need rewrite win_perform_blit use strandard C, but I don't understand the win_perform_blit how to work -__-
win_perform_blit make a mame_bitmap to display DIB? Who can tell me this function's algorithm ? or I can find a other way?
Thanks!
-
Hey, you need to just rewrite this in c using a loop, it's just a memory copy operation.
int win_perform_blit(const struct win_blit_params *blit, int update)
{
...
// copy data to the globals
asmblit_srcdata = (UINT8 *)blit->srcdata + blit->srcpitch * srcy + srcdepth * srcx;
asmblit_srcheight = blit->srcheight;
asmblit_srclookup = blit->srclookup;
asmblit_dstdata = (UINT8 *)blit->dstdata + blit->dstpitch * blit->dstyoffs + dstdepth * blit->dstxoffs;
asmblit_dstpitch = blit->dstpitch;
// pick the blitter
//blitter = update ? (blitter_func)active_update_blitter : //(blitter_func)active_fast_blitter;
//(*blitter)();
...
int c;
UINT8 * src = asmblit_srcdata;
UINT8 * dst= asmblit_dstdata;
for (c = 0;c<asmblit_srcheight;c++){
memcpy(dst,src,blit->dstpitch);
src += blit->srcpitch;
dst += blit->dstpitch;
}
}
hope this helps.
-PMF
-
Thank you a lot!
But if I change it to your code, Mame display a black screen
int win_perform_blit(const struct win_blit_params *blit, int update)
{
...
// copy data to the globals
asmblit_srcdata = (UINT8 *)blit->srcdata + blit->srcpitch * srcy + srcdepth * srcx;
asmblit_srcheight = blit->srcheight;
asmblit_srclookup = blit->srclookup;
asmblit_dstdata = (UINT8 *)blit->dstdata + blit->dstpitch * blit->dstyoffs + dstdepth * blit->dstxoffs;
asmblit_dstpitch = blit->dstpitch;
// pick the blitter
//blitter = update ? (blitter_func)active_update_blitter : //(blitter_func)active_fast_blitter;
//(*blitter)();
...
int c;
UINT8 * src = asmblit_srcdata;
UINT8 * dst= asmblit_dstdata;
for (c = 0;c<asmblit_srcheight;c++){
memcpy(dst,src,blit->dstpitch);
src += blit->srcpitch;
dst += blit->dstpitch;
}
return 1;
}
if I add this code, it crush... :'(
int win_perform_blit(const struct win_blit_params *blit, int update)
{
...
// copy data to the globals
asmblit_srcdata = (UINT8 *)blit->srcdata + blit->srcpitch * srcy + srcdepth * srcx;
asmblit_srcheight = blit->srcheight;
asmblit_srclookup = blit->srclookup;
asmblit_dstdata = (UINT8 *)blit->dstdata + blit->dstpitch * blit->dstyoffs + dstdepth * blit->dstxoffs;
asmblit_dstpitch = blit->dstpitch;
// pick the blitter
//blitter = update ? (blitter_func)active_update_blitter : //(blitter_func)active_fast_blitter;
//(*blitter)();
...
int c;
UINT8 * src = asmblit_srcdata;
UINT8 * dst= asmblit_dstdata;
for (c = 0;c<asmblit_srcheight;c++){
memcpy(dst,src,blit->dstpitch);
src += blit->srcpitch;
dst += blit->dstpitch;
}
// pick the blitter
blitter = update ? (blitter_func)active_update_blitter : (blitter_func)active_fast_blitter;
(*blitter)();
return 1;
}
What happened? blitter_func can't find dst's data?
BTW:Have any documents depict how to conversion mame_bitmap to display bitmap?
Thank you again!
-
get rid of the:
// pick the blitter
blitter = update ? (blitter_func)active_update_blitter : (blitter_func)active_fast_blitter;
(*blitter)();
the code I wrote IS the blitter. however I should note that it only works if the srcdepth == dstdepth. If srcdepth != dstdepth, you need to do a color conversion.
Set a breakpoint on the:
for (c = 0;c<asmblit_srcheight;c++){
memcpy(dst,src,blit->dstpitch);
src += blit->srcpitch;
dst += blit->dstpitch;
}
and look and see what the data is in the src blocks.
Also, check and see if you need to do a pageflip. That might be why it's black, it hasn't been copied to the current visible page.
-PMF
You might want to dig into the mame bitmap structure to see what it looks like. You could also try to use the CopyToDibsSection function to do the blit.
-PMF
-
Ok, at dib_draw_window functions, I watch mame_bitmap's data, it like this:
bitmap->width = 512;
bitmap->high = 256;
bitmap->depth = 16;
after win_perform_blit, it switch to a 320*224*16(555) bitmap save at converted_bitmap
I try write mame_bitmap and converted_bitmap to disk, converted_bitmap is correct, mame_bitmap is out-of-order, it like a tilemap...and at asmblit.asm, I note have a palette be load at here...
So, I don't think mame_bitmap is a strandard DIBBitmap