| 1 | /* |
| 2 | * Copyright (C) 2002-2024 D2X Project |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef INCLUDED_MVELIB_H |
| 19 | #define INCLUDED_MVELIB_Hcxx . . $ `libmve/mvelib.h:19:9`! |
| 20 | |
| 21 | #include <cstdio> |
| 22 | #include <cstdlib> |
| 23 | |
| 24 | /* callback for reading stream */ |
| 25 | typedef unsigned int (*mve_cb_Readcxx . . $ mve_cb_Read#)(void *stream, void *buffer, unsigned int count); |
| 26 | /* callback for memore allocating */ |
| 27 | typedef void *(*mve_cb_Alloccxx . . $ mve_cb_Alloc#)(unsigned int size); |
| 28 | /* callback for memory freeing */ |
| 29 | typedef void (*mve_cb_Freecxx . . $ mve_cb_Free#)(void *ptr); |
| 30 | /* callback for showing frame */ |
| 31 | typedef void (*mve_cb_ShowFramecxx . . $ mve_cb_ShowFrame#)(unsigned char *buffer, unsigned int bufw, unsigned int bufh, unsigned int sx, |
| 32 | unsigned int sy, unsigned int w, unsigned int h, unsigned int dstx, unsigned int dsty, |
| 33 | unsigned int hicolor); |
| 34 | /* callback for setting palette */ |
| 35 | typedef void (*mve_cb_SetPalettecxx . . $ mve_cb_SetPalette#)(const unsigned char *p, unsigned int start, unsigned int count); |
| 36 | /* callback for segment type */ |
| 37 | typedef int (*MVESEGMENTHANDLERcxx . . $ MVESEGMENTHANDLER#)(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context); |
| 38 | |
| 39 | extern mve_cb_Readcxx . . $ mve_cb_Read# mve_readcxx . . $ mve_read.; |
| 40 | extern mve_cb_Alloccxx . . $ mve_cb_Alloc# mve_alloccxx . . $ mve_alloc.; |
| 41 | extern mve_cb_Freecxx . . $ mve_cb_Free# mve_freecxx . . $ mve_free.; |
| 42 | extern mve_cb_ShowFramecxx . . $ mve_cb_ShowFrame# mve_showframecxx . . $ mve_showframe.; |
| 43 | extern mve_cb_SetPalettecxx . . $ mve_cb_SetPalette# mve_setpalettecxx . . $ mve_setpalette.; |
| 44 | |
| 45 | #define MVE_ERR_EOFcxx . . $ `libmve/mvelib.h:45:9`! 1 |
| 46 | |
| 47 | typedef structcxx . . $ $anonymous_type_e461a2138b30f544_0# { |
| 48 | int screenWidthcxx . . $ $anonymous_type_e461a2138b30f544_0#screenWidth.; |
| 49 | int screenHeightcxx . . $ $anonymous_type_e461a2138b30f544_0#screenHeight.; |
| 50 | int widthcxx . . $ $anonymous_type_e461a2138b30f544_0#width.; |
| 51 | int heightcxx . . $ $anonymous_type_e461a2138b30f544_0#height.; |
| 52 | int truecolorcxx . . $ $anonymous_type_e461a2138b30f544_0#truecolor.; |
| 53 | } MVE_videoSpeccxx . . $ MVE_videoSpec#; |
| 54 | |
| 55 | /* structure for maintaining info on a MVEFILE stream */ |
| 56 | typedef struct MVEFILEcxx . . $ MVEFILE# { |
| 57 | void *streamcxx . . $ MVEFILE#stream.; |
| 58 | unsigned char *cur_chunkcxx . . $ MVEFILE#cur_chunk.; |
| 59 | int buf_sizecxx . . $ MVEFILE#buf_size.; |
| 60 | int cur_fillcxx . . $ MVEFILE#cur_fill.; |
| 61 | int next_segmentcxx . . $ MVEFILE#next_segment.; |
| 62 | } MVEFILEcxx . . $ MVEFILE#; |
| 63 | |
| 64 | /* structure for maintaining an MVE stream */ |
| 65 | typedef struct MVESTREAMcxx . . $ MVESTREAM# { |
| 66 | MVEFILEcxx . . $ MVEFILE# *moviecxx . . $ MVESTREAM#movie.; |
| 67 | void *contextcxx . . $ MVESTREAM#context.; |
| 68 | MVESEGMENTHANDLERcxx . . $ MVESEGMENTHANDLER# handlerscxx . . $ MVESTREAM#handlers.[32]; |
| 69 | } MVESTREAMcxx . . $ MVESTREAM#; |
| 70 | |
| 71 | MVESTREAMcxx . . $ MVESTREAM#* MVE_rmPrepMoviecxx . . $ MVE_rmPrepMovie(2c2ed7ae2903cf25).(void *stream, int x, int y, int track); |
| 72 | int MVE_rmStepMoviecxx . . $ MVE_rmStepMovie(c6a4a7571c8c3481).(MVESTREAMcxx . . $ MVESTREAM# *mve); |
| 73 | void MVE_rmHoldMoviecxx . . $ MVE_rmHoldMovie(49f6e7a06ebc5aa8).(); |
| 74 | void MVE_rmEndMoviecxx . . $ MVE_rmEndMovie(322520e409d4025).(MVESTREAMcxx . . $ MVESTREAM# *mve); |
| 75 | |
| 76 | void MVE_getVideoSpeccxx . . $ MVE_getVideoSpec(2a90f1c080e52241).(MVE_videoSpeccxx . . $ MVE_videoSpec# *vSpec); |
| 77 | |
| 78 | // Initialize MVE sound. Set `enable` to false if sound should not be enabled. |
| 79 | void MVE_sndInitcxx . . $ MVE_sndInit(b45ddcbc8423892c).(const bool enable); |
| 80 | |
| 81 | void MVE_ioCallbackscxx . . $ MVE_ioCallbacks(db0132fb63dbf97d).(mve_cb_Readcxx . . $ mve_cb_Read# io_read); |
| 82 | void MVE_memCallbackscxx . . $ MVE_memCallbacks(19c120d411afc1d).(mve_cb_Alloccxx . . $ mve_cb_Alloc# mem_alloc, mve_cb_Freecxx . . $ mve_cb_Free# mem_free); |
| 83 | void MVE_sfCallbackscxx . . $ MVE_sfCallbacks(d9e6b75645a4c6c8).(mve_cb_ShowFramecxx . . $ mve_cb_ShowFrame# showframe); |
| 84 | void MVE_palCallbackscxx . . $ MVE_palCallbacks(93fa3d6c1e1dd934).(mve_cb_SetPalettecxx . . $ mve_cb_SetPalette# setpalette); |
| 85 | |
| 86 | // Low-level functions |
| 87 | |
| 88 | /* open an MVE file */ |
| 89 | MVEFILEcxx . . $ MVEFILE# *mvefile_opencxx . . $ mvefile_open(d986263c59db9590).(void *stream); |
| 90 | |
| 91 | /* close an MVE file */ |
| 92 | void mvefile_closecxx . . $ mvefile_close(e0260fc6b97b09ea).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 93 | |
| 94 | /* get size of next segment in chunk (-1 if no more segments in chunk) */ |
| 95 | int mvefile_get_next_segment_sizecxx . . $ mvefile_get_next_segment_size(1d7e7661686dc57e).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 96 | |
| 97 | /* get type of next segment in chunk (0xff if no more segments in chunk) */ |
| 98 | unsigned char mvefile_get_next_segment_majorcxx . . $ mvefile_get_next_segment_major(23378c90094c51ff).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 99 | |
| 100 | /* get subtype (version) of next segment in chunk (0xff if no more segments in chunk) */ |
| 101 | unsigned char mvefile_get_next_segment_minorcxx . . $ mvefile_get_next_segment_minor(23378c90094c51ff).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 102 | |
| 103 | /* see next segment (return NULL if no next segment) */ |
| 104 | unsigned char *mvefile_get_next_segmentcxx . . $ mvefile_get_next_segment(84d9daf51fdf2d72).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 105 | |
| 106 | /* advance to next segment */ |
| 107 | void mvefile_advance_segmentcxx . . $ mvefile_advance_segment(e0260fc6b97b09ea).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 108 | |
| 109 | /* fetch the next chunk (return 0 if at end of stream) */ |
| 110 | int mvefile_fetch_next_chunkcxx . . $ mvefile_fetch_next_chunk(1d7e7661686dc57e).(MVEFILEcxx . . $ MVEFILE# *movie); |
| 111 | |
| 112 | /* open an MVE stream */ |
| 113 | MVESTREAMcxx . . $ MVESTREAM# *mve_opencxx . . $ mve_open(773157b047541329).(void *stream); |
| 114 | |
| 115 | /* close an MVE stream */ |
| 116 | void mve_closecxx . . $ mve_close(322520e409d4025).(MVESTREAMcxx . . $ MVESTREAM# *movie); |
| 117 | |
| 118 | /* reset an MVE stream */ |
| 119 | void mve_resetcxx . . $ mve_reset(322520e409d4025).(MVESTREAMcxx . . $ MVESTREAM# *movie); |
| 120 | |
| 121 | /* set segment type handler */ |
| 122 | void mve_set_handlercxx . . $ mve_set_handler(208c9697527ebac9).(MVESTREAMcxx . . $ MVESTREAM# *movie, unsigned char major, MVESEGMENTHANDLERcxx . . $ MVESEGMENTHANDLER# handler); |
| 123 | |
| 124 | /* set segment handler context */ |
| 125 | void mve_set_handler_contextcxx . . $ mve_set_handler_context(e7085631e81cf0a8).(MVESTREAMcxx . . $ MVESTREAM# *movie, void *context); |
| 126 | |
| 127 | /* play next chunk */ |
| 128 | int mve_play_next_chunkcxx . . $ mve_play_next_chunk(c6a4a7571c8c3481).(MVESTREAMcxx . . $ MVESTREAM# *movie); |
| 129 | |
| 130 | #endif /* INCLUDED_MVELIB_H */ |