summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-09-18 15:17:42 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-09-18 15:17:42 +0000
commit1eb3c2d964342aef09a08d854bdab6716a6792bd (patch)
treeac364ed9466a0556e178770d87855ed21ce113ea /src/lib/util
parent8e4ed692473ee31f5fdeee460526357ee4440392 (diff)
Changed requirements for laserdisc CHDs to require a new chunk of
metadata with pre-decoded frame information. Modified chdman to automatically produce this for CHDs that are of the appropriate parameters. To fix up existing CHDs, use chdman -fixavdata on the CHD. Modified the laserdisc core to leverage the pre-decoded frame metadata, which is now required. This improves seek times when searching and allows the player-specific emulation access to the VBI data as soon as it would really be available. Changed update callback timing to fire just before the first line of VBI data would be read; at that point, the frame selection is assumed to be committed. Converted PR-8210 emulation over to using the actual MCU from the laserdisc player. This MCU controls low-level functions such as slider position and laser on/off, and receives decoded vertical blanking data in order to make decisions. Removed old HLE behavior. Note that the overlay text is displayed via the UI; this is temporary and will be fixed shortly. Converted Simutrek-hacked laserdisc emulation to using the actual MCU from the game, which in turn hands off commands to the PR-8210 MCU. This is still not 100% but is pretty close at this point and achieves the correct behaviors in most cases. Fixed Cube Quest overlay scaling to cover the whole screen. Changed laserdisc video parameters to position the screen area at the bottom rather than the top, since this corresponds more closely to standard line numbering. Extended the vbiparse code to support pack/unpack, and to more fully document all the meanings of the VBI codes. Updated ldplayer to support slow/fast forward movement, frame/chapter display, and separate controls for scanning/stepping. Added new built-in variable "frame" to the debugger. Fixed device-based ROM loading to support loading ROMs from the game's ZIP as well.
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/chd.h3
-rw-r--r--src/lib/util/vbiparse.c45
-rw-r--r--src/lib/util/vbiparse.h46
3 files changed, 93 insertions, 1 deletions
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index 7914a9161f9..d8c74dca5d9 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -130,6 +130,9 @@
#define AV_METADATA_TAG 0x41564156 /* 'AVAV' */
#define AV_METADATA_FORMAT "FPS:%d.%06d WIDTH:%d HEIGHT:%d INTERLACED:%d CHANNELS:%d SAMPLERATE:%d"
+/* A/V laserdisc frame metadata */
+#define AV_LD_METADATA_TAG 0x41564C44 /* 'AVLD' */
+
/* CHD open values */
#define CHD_OPEN_READ 1
#define CHD_OPEN_READWRITE 2
diff --git a/src/lib/util/vbiparse.c b/src/lib/util/vbiparse.c
index 65f1061cf91..83a3331ca23 100644
--- a/src/lib/util/vbiparse.c
+++ b/src/lib/util/vbiparse.c
@@ -318,7 +318,7 @@ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, i
else
{
/* if both are frame numbers, and one is not valid BCD, pick the other */
- if ((vbi->line17 & 0xf80000) == 0xf80000 && (vbi->line18 & 0xf80000) == 0xf80000)
+ if ((vbi->line17 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE && (vbi->line18 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
{
if ((vbi->line17 & 0xf000) > 0x9000 || (vbi->line17 & 0xf00) > 0x900 || (vbi->line17 & 0xf0) > 0x90 || (vbi->line17 & 0xf) > 0x9)
vbi->line1718 = vbi->line18;
@@ -332,3 +332,46 @@ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, i
vbi->line1718 = (vbi->line1718 << 1) | ((bits[0][bitnum] > bits[1][bitnum]) ? (bits[0][bitnum] & 1) : (bits[1][bitnum] & 1));
}
}
+
+
+/*-------------------------------------------------
+ vbi_metadata_pack - pack the VBI data down
+ into a smaller form for storage
+-------------------------------------------------*/
+
+void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi)
+{
+ dest[0] = framenum >> 16;
+ dest[1] = framenum >> 8;
+ dest[2] = framenum >> 0;
+ dest[3] = vbi->white;
+ dest[4] = vbi->line16 >> 16;
+ dest[5] = vbi->line16 >> 8;
+ dest[6] = vbi->line16 >> 0;
+ dest[7] = vbi->line17 >> 16;
+ dest[8] = vbi->line17 >> 8;
+ dest[9] = vbi->line17 >> 0;
+ dest[10] = vbi->line18 >> 16;
+ dest[11] = vbi->line18 >> 8;
+ dest[12] = vbi->line18 >> 0;
+ dest[13] = vbi->line1718 >> 16;
+ dest[14] = vbi->line1718 >> 8;
+ dest[15] = vbi->line1718 >> 0;
+}
+
+
+/*-------------------------------------------------
+ vbi_metadata_unpack - unpack the VBI data
+ from a smaller form into the full structure
+-------------------------------------------------*/
+
+void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source)
+{
+ *framenum = (source[0] << 16) | (source[1] << 8) | source[2];
+ vbi->white = source[3];
+ vbi->line16 = (source[4] << 16) | (source[5] << 8) | source[6];
+ vbi->line17 = (source[7] << 16) | (source[8] << 8) | source[9];
+ vbi->line18 = (source[10] << 16) | (source[11] << 8) | source[12];
+ vbi->line1718 = (source[13] << 16) | (source[14] << 8) | source[15];
+}
+
diff --git a/src/lib/util/vbiparse.h b/src/lib/util/vbiparse.h
index 5e4a594f6a1..02af240265d 100644
--- a/src/lib/util/vbiparse.h
+++ b/src/lib/util/vbiparse.h
@@ -16,6 +16,46 @@
/***************************************************************************
+ CONSTANTS
+***************************************************************************/
+
+/* size of packed VBI data */
+#define VBI_PACKED_BYTES 16
+
+/* these codes are full 24-bit codes with no parameter data */
+#define VBI_CODE_LEADIN 0x88ffff
+#define VBI_CODE_LEADOUT 0x80eeee
+#define VBI_CODE_STOP 0x82cfff
+#define VBI_CODE_CLV 0x87ffff
+
+/* these codes require a mask because some bits are parameters */
+#define VBI_MASK_CAV_PICTURE 0xf00000
+#define VBI_CODE_CAV_PICTURE 0xf00000
+#define VBI_MASK_CHAPTER 0xf00fff
+#define VBI_CODE_CHAPTER 0x800ddd
+#define VBI_MASK_CLV_TIME 0xf0ff00
+#define VBI_CODE_CLV_TIME 0xf0dd00
+#define VBI_MASK_STATUS_CX_ON 0xfff000
+#define VBI_CODE_STATUS_CX_ON 0x8dc000
+#define VBI_MASK_STATUS_CX_OFF 0xfff000
+#define VBI_CODE_STATUS_CX_OFF 0x8bc000
+#define VBI_MASK_USER 0xf0f000
+#define VBI_CODE_USER 0x80d000
+#define VBI_MASK_CLV_PICTURE 0xf0f000
+#define VBI_CODE_CLV_PICTURE 0x80e000
+
+
+
+/***************************************************************************
+ MACROS
+***************************************************************************/
+
+#define VBI_CAV_PICTURE(x) (((((x) >> 16) & 0x07) * 10000) + ((((x) >> 12) & 0x0f) * 1000) + ((((x) >> 8) & 0x0f) * 100) + ((((x) >> 4) & 0x0f) * 10) + ((((x) >> 0) & 0x0f) * 1))
+#define VBI_CHAPTER(x) (((((x) >> 16) & 0x07) * 10) + ((((x) >> 12) & 0x0f) * 1))
+
+
+
+/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@@ -44,5 +84,11 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
/* parse everything from a video frame */
void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi);
+/* pack the VBI data down into a smaller form for storage */
+void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi);
+
+/* unpack the VBI data from a smaller form into the full structure */
+void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source);
+
#endif /* __VBIPARSE_H__ */