diff --git a/src/libs/zmbv/drvproc.cpp b/src/libs/zmbv/drvproc.cpp index 44b6ab61..299e5e67 100644 --- a/src/libs/zmbv/drvproc.cpp +++ b/src/libs/zmbv/drvproc.cpp @@ -68,7 +68,7 @@ * Defined separately for each message. * ***************************************************************************/ -LRESULT PASCAL DriverProc(DWORD dwDriverID, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2) { +extern "C" LRESULT PASCAL __declspec(dllexport) DriverProc(DWORD dwDriverID, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2) { CodecInst* pi = (CodecInst*)dwDriverID; switch (uiMessage) { diff --git a/src/libs/zmbv/makedll.mk b/src/libs/zmbv/makedll.mk new file mode 100644 index 00000000..c2b0b024 --- /dev/null +++ b/src/libs/zmbv/makedll.mk @@ -0,0 +1,17 @@ +CPP=g++ +CPPFLAGS=-O3 +LIBS=-static -lz -lwinmm -static-libgcc -static-libstdc++ + +OBJ = resource.o zmbv.o drvproc.o zmbv_vfw.o + +default: zmbv.dll + + +resource.o: resource.rc + windres -i resource.rc -o resource.o + +%.o: %.cpp + $(CPP) -c -o $@ $< $(CPPFLAGS) + +zmbv.dll: $(OBJ) + $(CPP) -shared -o $@ $^ $(CPPFLAGS) $(LIBS) zmbv_mingw.def \ No newline at end of file diff --git a/src/libs/zmbv/resource.h b/src/libs/zmbv/resource.h index f4830af1..0d6f72a0 100644 --- a/src/libs/zmbv/resource.h +++ b/src/libs/zmbv/resource.h @@ -1,21 +1,8 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by zmbv_vfw.rc -// + #define IDD_ABOUT 101 #define IDD_CONFIGURE 102 #define IDC_HOMEPAGE 1000 #define IDC_EMAIL 1001 #define IDC_SLIDER1 1008 -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1009 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/libs/zmbv/resource.rc b/src/libs/zmbv/resource.rc new file mode 100644 index 00000000..5e4e3a48 --- /dev/null +++ b/src/libs/zmbv/resource.rc @@ -0,0 +1,40 @@ +#include "resource.h" +#include "windows.h" + +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUT DIALOGEX 0, 0, 167, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "DOSBox Video Codec v0.1a" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,131,34,29,14 + CTEXT "Zipped Motion Block Video v 0.1\nCopyright 2009-2019 DOSBox Team", + IDC_STATIC,7,7,153,25,SS_NOPREFIX + PUSHBUTTON "Email author",IDC_EMAIL,7,34,50,14 + PUSHBUTTON "Visit home page",IDC_HOMEPAGE,59,34,58,14 +END + +IDD_CONFIGURE DIALOGEX 0, 0, 213, 146 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "ZMBV configuration dialog" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + PUSHBUTTON "Email author",IDC_EMAIL,44,86,50,14 + PUSHBUTTON "Visit home page",IDC_HOMEPAGE,109,87,58,14 + DEFPUSHBUTTON "OK",IDOK,44,125,50,14 + PUSHBUTTON "Cancel",IDCANCEL,117,125,50,14 + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,57,30,92,18 +END + + diff --git a/src/libs/zmbv/zmbv_mingw.def b/src/libs/zmbv/zmbv_mingw.def new file mode 100644 index 00000000..04142744 --- /dev/null +++ b/src/libs/zmbv/zmbv_mingw.def @@ -0,0 +1,2 @@ +EXPORTS + DriverProc = DriverProc@20 @1 diff --git a/src/libs/zmbv/zmbv_vfw.cpp b/src/libs/zmbv/zmbv_vfw.cpp index dec8dc6f..3be8459e 100644 --- a/src/libs/zmbv/zmbv_vfw.cpp +++ b/src/libs/zmbv/zmbv_vfw.cpp @@ -30,10 +30,10 @@ #include #include -TCHAR szDescription[] = TEXT("Zipped Motion Block Video v0.1"); +TCHAR szDescription[] = TEXT("Zipped Motion Block Video v0.1a"); TCHAR szName[] = TEXT(CODEC_4CC); -#define VERSION 0x00000001 // 0.1 +#define VERSION 0x00000002 // newer version /******************************************************************** ********************************************************************/ @@ -90,7 +90,7 @@ DWORD Close(CodecInst* pinst) { BOOL CodecInst::QueryAbout() { return TRUE; } -static BOOL CALLBACK AboutDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { +static INT_PTR CALLBACK AboutDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_COMMAND) { switch (LOWORD(wParam)) { case IDOK: @@ -111,7 +111,7 @@ DWORD CodecInst::About(HWND hwnd) { return ICERR_OK; } -static BOOL CALLBACK ConfigureDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { +static INT_PTR CALLBACK ConfigureDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_INITDIALOG) { @@ -175,6 +175,7 @@ DWORD CodecInst::GetInfo(ICINFO* icinfo, DWORD dwSize) { ****************************************************************/ static int GetInputBitDepth(const BITMAPINFOHEADER *lpbiIn) { + //Msg( "Get input depth compression %d bitcount %d\n", lpbiIn->biCompression, lpbiIn->biBitCount ); if (lpbiIn->biCompression == BI_RGB) { if (lpbiIn->biPlanes != 1) return -1; @@ -214,11 +215,14 @@ static bool CanCompress(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, b if (lpbiIn) { if (GetInputBitDepth(lpbiIn) < 0) return false; - } else return false; + } else + return false; if (lpbiOut) { + //Needs to match our 4cc format if (memcmp(&lpbiOut->biCompression,CODEC_4CC, 4)) return false; - } else return !requireOutput; + } else + return !requireOutput; return true; } @@ -226,7 +230,8 @@ static bool CanCompress(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, b ****************************************************************/ DWORD CodecInst::CompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut) { - if (CanCompress(lpbiIn,lpbiOut,false)) return ICERR_OK; + if (CanCompress(lpbiIn,lpbiOut,false)) + return ICERR_OK; return ICERR_BADFORMAT; } @@ -373,7 +378,8 @@ DWORD CodecInst::DecompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER l DWORD CodecInst::DecompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut) { if (memcmp(&lpbiIn->biCompression,CODEC_4CC,4)) return ICERR_BADFORMAT; - if (!lpbiOut) return sizeof(BITMAPINFOHEADER); + if (!lpbiOut) + return sizeof(BITMAPINFOHEADER); *lpbiOut = *lpbiIn; lpbiOut->biPlanes = 1; lpbiOut->biSize = sizeof(BITMAPINFOHEADER);