mirror of
https://github.com/holub/mame
synced 2025-05-29 00:53:09 +03:00
psikyoah: remove hard-coded zoom table and replace with 1/x function
This commit is contained in:
parent
3a35df8d63
commit
01b4e958d3
@ -30,7 +30,8 @@ struct _psikyosh_state
|
||||
|
||||
/* video-related */
|
||||
bitmap_t *zoom_bitmap, *z_bitmap, *bg_bitmap;
|
||||
// UINT8 * alphatable;
|
||||
UINT16 *bg_zoom;
|
||||
// UINT8 *alphatable;
|
||||
|
||||
/* misc */
|
||||
UINT32 sample_offs; // only used if ROMTEST = 1
|
||||
|
@ -48,12 +48,11 @@ Video Registers: at 0x305ffe0 for ps3 or 0x405ffe0 for ps5/ps5v2:
|
||||
|
||||
/*
|
||||
TODO:
|
||||
* Fix background line zoom. There must be an internal LUT, current implmentation is based on eye-balling.
|
||||
* Correct sprite-sprite priority? Currently this is strictly in the order of the sprites in the sprite list. However, there's an additional priority parameter which looks to split the sprites into 4 discrete sets with decreasing priority. In addition to the sprite-tilemap mixing the only way I can think to emulate this is how the hardware would work. Iterate over the sprite list 4 times rendering the sprites to a bitmap, and then mix each pixel against the tilemaps and other elements with comparable priority. This will be pretty slow though. Justification: The unknown priority bits are used to seperate score/enemy bullets from ships/enemies from incidental effects. daraku appears to have a black, screen-filling srite which it uses for a flash immediately efore the screen fade/white flash when doing special moves. Currently obscured behind the other sprites.
|
||||
* Perform tests on real hardware to document limits and remaining registers
|
||||
** Fix background line zoom to be pixel-correct. There must be an internal LUT.
|
||||
** Confirm existence of 4th tilemap layer on real hw by configuring it. No games ever get as far as enabling it.
|
||||
** Confirm sprite-sprite priority behaviours (two overlapping sprites in sprite list order, with differing priorities etc.)
|
||||
** Confirm xscroll/xzoom are applied in the right order
|
||||
** Figure out why the sprite zoom is not 100% when we even have a lookup table. See TGM2 MT report. Possibly we should offset calcs by half a pixel (i.e. start in the middle of the first source pixel rather than corner).
|
||||
** Figure out screen size registers and xflip/yflip
|
||||
* Hookup configurable sprite banks (not needed? reports of tgm2 dropping sprites when busy on real hw)
|
||||
@ -74,43 +73,6 @@ The only viable way to do this is to have one tilemap per bank (0x0a-0x20), and
|
||||
|
||||
static UINT8 alphatable[256]; // this might be moved to psikyosh_state, if we ever add a *machine parameter to drawgfxm.h macros
|
||||
|
||||
/* This is based on observations of the zoom using the s1945ii maintenance mode mode tilemap test. These are .10 fixed point source pixel increments.
|
||||
High bit set if verified on hardware to produce a tilemap of the same height to the nearest pixel. Other values are simply linearly interpolated */
|
||||
static UINT16 bg_zoom[256] = {
|
||||
0x8400, 0x83f4, 0x83e8, 0x83d8, 0x83c8, 0x83b8, 0x83ac, 0x83a0, // 0000
|
||||
0x8394, 0x8388, 0x8378, 0x836c, 0x8360, 0x8358, 0x834c, 0x8340, // 0x01
|
||||
0x8334, 0x032b, 0x0322, 0x0319, 0x0310, 0x0307, 0x02fe, 0x02f5, // 0x02
|
||||
0x82ec, 0x02e3, 0x02db, 0x02d3, 0x02cb, 0x02c2, 0x02ba, 0x02b2, // 0x03
|
||||
0x82aa, 0x02a3, 0x029c, 0x0295, 0x028f, 0x0288, 0x0281, 0x027a, // 0x04
|
||||
0x8274, 0x026e, 0x0269, 0x0263, 0x025e, 0x0258, 0x0253, 0x024d, // 0x05
|
||||
0x8248, 0x0243, 0x023e, 0x0239, 0x0234, 0x022f, 0x022a, 0x0225, // 0x06
|
||||
0x8220, 0x021c, 0x0218, 0x0214, 0x0210, 0x020c, 0x0208, 0x0204, // 0x07
|
||||
0x8200, 0x01fc, 0x01f9, 0x01f5, 0x01f2, 0x01ee, 0x01eb, 0x01e7, // 0x08
|
||||
0x81e4, 0x01e0, 0x01dd, 0x01d9, 0x01d6, 0x01d2, 0x01cf, 0x01cb, // 0x09
|
||||
0x81c8, 0x01c5, 0x01c2, 0x01bf, 0x01bc, 0x01b9, 0x01b6, 0x01b3, // 0x0a
|
||||
0x81b0, 0x01ad, 0x01aa, 0x01a7, 0x01a4, 0x01a1, 0x019e, 0x019b, // 0x0b
|
||||
0x8198, 0x0195, 0x0193, 0x0191, 0x018f, 0x018c, 0x018a, 0x0188, // 0x0c
|
||||
0x8186, 0x0183, 0x0181, 0x017f, 0x017d, 0x017a, 0x0178, 0x0176, // 0x0d
|
||||
0x8174, 0x0172, 0x0170, 0x016e, 0x016c, 0x016a, 0x0168, 0x0166, // 0x0e
|
||||
0x8164, 0x0162, 0x0160, 0x015e, 0x015d, 0x015b, 0x0159, 0x0157, // 0x0f
|
||||
0x8156, 0x0154, 0x0152, 0x0150, 0x014f, 0x014d, 0x014b, 0x0149, // 0x10
|
||||
0x8148, 0x0146, 0x0145, 0x0143, 0x0142, 0x0140, 0x013f, 0x013d, // 0x11
|
||||
0x813c, 0x013a, 0x0139, 0x0138, 0x0137, 0x0135, 0x0134, 0x0133, // 0x12
|
||||
0x8132, 0x0130, 0x012e, 0x012c, 0x012b, 0x0129, 0x0127, 0x0125, // 0x13
|
||||
0x8124, 0x0122, 0x0121, 0x0120, 0x011f, 0x011d, 0x011c, 0x011b, // 0x14
|
||||
0x811a, 0x0118, 0x0117, 0x0116, 0x0115, 0x0114, 0x0113, 0x0112, // 0x15
|
||||
0x8111, 0x010f, 0x010e, 0x010d, 0x010c, 0x010b, 0x010a, 0x0109, // 0x16
|
||||
0x8108, 0x0107, 0x0106, 0x0105, 0x0104, 0x0103, 0x0102, 0x0101, // 0x17
|
||||
0x8100, 0x00ff, 0x00fe, 0x00fd, 0x00fc, 0x00fb, 0x00fa, 0x00f9, // 0x18
|
||||
0x80f9, 0x00f8, 0x00f7, 0x00f6, 0x00f5, 0x00f4, 0x00f3, 0x00f2, // 0x19
|
||||
0x80f2, 0x00f1, 0x00f0, 0x00ef, 0x00ee, 0x00ed, 0x00ec, 0x00eb, // 0x1a
|
||||
0x80eb, 0x00ea, 0x00e9, 0x00e8, 0x00e7, 0x00e6, 0x00e5, 0x00e4, // 0x1b
|
||||
0x80e4, 0x00e3, 0x00e2, 0x00e1, 0x00e0, 0x00df, 0x00de, 0x00dd, // 0x1c
|
||||
0x80dd, 0x00dc, 0x00db, 0x00db, 0x00da, 0x00d9, 0x00d9, 0x00d8, // 0x1d
|
||||
0x80d8, 0x00d7, 0x00d6, 0x00d5, 0x00d5, 0x00d4, 0x00d3, 0x00d2, // 0x1e
|
||||
0x80d2, 0x80d1, 0x80d1, 0x80d0, 0x80cf, 0x80cf, 0x80ce, 0x80cd, // 0x1f
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
palette.h like macros
|
||||
@ -484,8 +446,8 @@ static void draw_bglayerscroll( running_machine *machine, int layer, bitmap_t *b
|
||||
|
||||
/* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */
|
||||
profiler_mark_start(PROFILER_USER3);
|
||||
int step = bg_zoom[zoom] & 0x7fff;
|
||||
if(zoom) {
|
||||
int step = state->bg_zoom[zoom];
|
||||
int jj = 0x400 << 10; // ensure +ve for mod
|
||||
for(int ii = 0; ii < scr_width; ii++) {
|
||||
scr_line[ii] = tilemap_line[((jj>>10) - scrollx) % width];
|
||||
@ -1297,24 +1259,31 @@ VIDEO_START( psikyosh )
|
||||
state->z_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); /* z-buffer */
|
||||
state->zoom_bitmap = auto_bitmap_alloc(machine, 16*16, 16*16, BITMAP_FORMAT_INDEXED8); /* temp buffer for assembling sprites */
|
||||
state->bg_bitmap = auto_bitmap_alloc(machine, 32*16, 32*16, BITMAP_FORMAT_RGB32); /* temp buffer for assembling tilemaps */
|
||||
state->bg_zoom = auto_alloc_array(machine, UINT16, 256);
|
||||
|
||||
machine->gfx[1]->color_granularity = 16; /* 256 colour sprites with palette selectable on 16 colour boundaries */
|
||||
|
||||
{ /* Pens 0xc0-0xff have a gradient of alpha values associated with them */
|
||||
int i;
|
||||
for (i = 0; i < 0xc0; i++) {
|
||||
alphatable[i] = 0xff;
|
||||
}
|
||||
for (i = 0; i < 0x40; i++)
|
||||
{
|
||||
int alpha = pal6bit(0x3f - i);
|
||||
alphatable[i + 0xc0] = alpha;
|
||||
}
|
||||
/* Pens 0xc0-0xff have a gradient of alpha values associated with them */
|
||||
int i;
|
||||
for (i = 0; i < 0xc0; i++) {
|
||||
alphatable[i] = 0xff;
|
||||
}
|
||||
for (i = 0; i < 0x40; i++)
|
||||
{
|
||||
int alpha = pal6bit(0x3f - i);
|
||||
alphatable[i + 0xc0] = alpha;
|
||||
}
|
||||
|
||||
/* precompute the background zoom table. verified against hardware.
|
||||
unsure of the precision, we use .10 fixed point like the sprites */
|
||||
for(i = 0; i < 0x100; i++) {
|
||||
state->bg_zoom[i] = (64. / (i + 64.)) * 0x400;
|
||||
}
|
||||
|
||||
state_save_register_global_bitmap(machine, state->z_bitmap);
|
||||
state_save_register_global_bitmap(machine, state->zoom_bitmap);
|
||||
state_save_register_global_bitmap(machine, state->bg_bitmap);
|
||||
state_save_register_global_pointer(machine, state->bg_zoom, 256);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user