1
0
Fork 0

Changes to allow for mingw i686 to compile a new zmbv.dll

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4247
This commit is contained in:
Sjoerd van der Berg 2019-06-25 20:44:00 +00:00
parent 0abb573167
commit e48149278e
6 changed files with 75 additions and 23 deletions

View file

@ -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) {

17
src/libs/zmbv/makedll.mk Normal file
View file

@ -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

View file

@ -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

40
src/libs/zmbv/resource.rc Normal file
View file

@ -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

View file

@ -0,0 +1,2 @@
EXPORTS
DriverProc = DriverProc@20 @1

View file

@ -30,10 +30,10 @@
#include <crtdbg.h>
#include <string.h>
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);