Winelib CoolPlayer port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

This is what's needed to compile CoolPlayer as a Winelib app. CoolPlayer is an MP3/OGG/stream player for Windows.

Note that the patches doesn't touch anything inside of Wine. CVS Wine is needed until the next release though.

The main change is the Makefiles, as CoolPlayer is currently developed with MS Visual Studio.
Then there's the usual filename case-sensitivity.
After that a typo and an empty enum declaration in an unused function prototype.
Next is a difference in inline asm syntax between MSVC and gcc. Somebody got a better way to do it?
Then is some type definition (might be better fixed in another way).
This ends the conversion to gcc.


Next is the actual Winelib stuff, which is very small.
The first part is an MFC header (thankfully, nothing else seems to be needed from MFC).
The second part is the only problematic thing. The current div implementation works fine for binary compatibility on i386, but doesn't work well for source level compatibility on the same platform. Other platforms are fine. This is really the only thing which needs to change in Wine.


Next phase is to get the relevant changes accepted in CoolPlayer (already started), and fix the last Wine issue so that div_t d=div(a, b) works as expected.

Vincent
diff -urN CoolPlayerCVS-20030421-2130-orig/libmad/Makefile CoolPlayerCVS-20030421-2130/libmad/Makefile
--- CoolPlayerCVS-20030421-2130-orig/libmad/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ CoolPlayerCVS-20030421-2130/libmad/Makefile	2003-04-21 22:17:22.000000000 -0400
@@ -0,0 +1,63 @@
+# Standard Variables
+
+CC = winegcc
+AR = ar rc
+RM = rm -f
+RANLIB = ranlib
+CBASEFLAGS = -W -Wall $(INCDIRS) -mno-cygwin
+CPPBASEFLAGS = -D_LIB -DHAVE_CONFIG_H -DASO_ZEROCHECK -DWIN32
+
+INCDIRS = -I.
+OPTIMIZ = -O2
+STRIP = -s
+
+# Compilation flags
+
+CFLAGS = $(CBASEFLAGS) -g
+CPPFLAGS = $(CPPBASEFLAGS) -DFPM_DEFAULT -D_DEBUG -DDEBUG
+
+# Main target
+
+BINDIR = .
+
+TARGET = $(BINDIR)/libmad.a
+
+C_SRCS = \
+	bit.c \
+	decoder.c \
+	fixed.c \
+	frame.c \
+	huffman.c \
+	layer12.c \
+	layer3.c \
+	stream.c \
+	synth.c \
+	timer.c \
+	version.c
+
+OBJS = $(C_SRCS:%.c=%.o)
+
+# Explicit rules
+%.o : %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCDIRS) -c -o $@ $<
+
+# Targets
+
+all: $(TARGET)
+
+debug: $(TARGET)
+
+$(TARGET): deps $(OBJS)
+	$(RM) $@
+	$(AR) $@ $(OBJS)
+	$(RANLIB) $@
+
+clean:
+	$(RM) $(TARGET) $(OBJS) deps
+
+# Automatic Dependencies
+
+deps: $(C_SRCS)
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIRS) $(C_SRCS) > $@
+
+-include deps
diff -urN CoolPlayerCVS-20030421-2130-orig/Makefile CoolPlayerCVS-20030421-2130/Makefile
--- CoolPlayerCVS-20030421-2130-orig/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ CoolPlayerCVS-20030421-2130/Makefile	2003-04-21 22:24:36.000000000 -0400
@@ -0,0 +1,132 @@
+# Standard Variables
+
+CC = winegcc
+RM = rm -f
+WRES = wrc
+CBASEFLAGS = -W -Wall $(INCDIRS) -mno-cygwin
+CPPBASEFLAGS = -D_WINDOWS -DWIN32
+LDBASEFLAGS = -mno-cygwin
+
+WINELIBDIR = /home/vincent/source/wine-20030421-2130-CoolPlayer
+#WINELIBDIR = /usr/lib/wine
+WINEINCDIR = /home/vincent/source/wine-20030421-2130-CoolPlayer
+#WINEINCDIR = /usr/include/wine
+LIBDIRS = -L$(WINELIBDIR)/dlls -L$(WINELIBDIR)/libs/uuid -L$(WINELIBDIR)/libs/wine
+#LIBDIRS = -L$(WINELIBDIR)/wine -L$(WINELIBDIR)
+LIBS = ./libmad/libmad.a ./vorbis/vorbisfile_static.a ./vorbis/vorbis_static.a ./ogg/ogg_static.a -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -luuid -lcomctl32 -lwinmm -lwsock32 -ldsound -lwininet -lm
+INCDIRS = -I. -I./ogg/include -I./vorbis/include -I$(WINEINCDIR)/include -I$(WINEINCDIR)/include/msvcrt
+OPTIMIZ = -O2
+STRIP = -s
+
+SUBDIRS = \
+	libmad \
+	ogg \
+	vorbis
+
+# Compilation flags
+
+CFLAGS = $(CBASEFLAGS) -g
+CPPFLAGS = $(CPPBASEFLAGS) -D_DEBUG -DMEM_DEBUG=1
+LDFLAGS = $(LDBASEFLAGS)
+
+# Main target
+
+BINDIR = .
+
+TARGET = $(BINDIR)/coolplayer.exe
+
+C_SRCS = \
+	about.c \
+	bitmap2region.c \
+	CLV_ListView.c \
+	CompositeFile.c \
+	CPI_CircleBuffer.c \
+	CPI_Equaliser_Basic.c \
+	CPI_ID3_Genres.c \
+	CPI_Image.c \
+	CPI_Interface.c \
+	CPI_InterfacePart.c \
+	CPI_InterfacePart_CommandButton.c \
+	CPI_Keyboard.c \
+	CPI_Player.c \
+	CPI_Player_Callbacks.c \
+	CPI_Player_CoDec_MPEG.c \
+	CPI_Player_CoDec_OGG.c \
+	CPI_Player_CoDec_WAV.c \
+	CPI_Player_CoDec_WinAmpPlugin.c \
+	CPI_Player_Engine.c \
+	CPI_Player_FileAssoc.c \
+	CPI_Player_Output_DirectSound.c \
+	CPI_Player_Output_File.c \
+	CPI_Player_Output_Wave.c \
+	CPI_Playlist.c \
+	CPI_Playlist_Callbacks.c \
+	CPI_PlaylistItem.c \
+	CPI_PlaylistWindow.c \
+	CPI_Stream.c \
+	CPI_Stream_Internet.c \
+	CPI_Stream_LocalFile.c \
+	CPI_Verbs.c \
+	CPSK_Skin.c \
+	DLG_Find.c \
+	main.c \
+	options.c \
+	playlist.c \
+	profile.c \
+	RotatingIcon.c \
+	shwapi.c \
+	skin.c \
+	stdafx.c \
+	WindowsOS.c \
+	ZLib/adler32.c \
+	ZLib/crc32.c \
+	ZLib/infblock.c \
+	ZLib/infcodes.c \
+	ZLib/inffast.c \
+	ZLib/inflate.c \
+	ZLib/inftrees.c \
+	ZLib/infutil.c \
+	ZLib/zutil.c
+
+RC_SRCS = \
+	coolplayer.rc
+
+OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
+RC_OBJS = $(RC_SRCS:.rc=.res.o)
+
+# Explicit rules
+%.o : %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCDIRS) -c -o $@ $<
+
+%.res.o : %.rc
+	$(WRES) $(CPPFLAGS) $(INCDIRS) $< $@
+
+# Targets
+
+all: $(SUBDIRS) $(TARGET)
+
+$(SUBDIRS): dummy
+	@cd $@ && $(MAKE)
+
+debug: $(SUBDIRS:%=%/__debug__) $(TARGET)
+
+$(SUBDIRS:%=%/__debug__): dummy
+	cd `dirname $@` && $(MAKE) debug
+
+$(TARGET): deps $(OBJS) $(RC_OBJS)
+	$(CC) -mwindows $(LDFLAGS) $(LIBDIRS) -o $@ $(OBJS) $(RC_OBJS) $(LIBS)
+
+clean: $(SUBDIRS:%=%/__clean__)
+	$(RM) $(TARGET:.exe=) $(TARGET:.exe=.exe.so) $(OBJS) $(RC_OBJS) deps
+
+$(SUBDIRS:%=%/__clean__): dummy
+	cd `dirname $@` && $(MAKE) clean
+
+.PHONY: dummy all debug clean $(SUBDIRS) $(SUBDIRS:%=%/__debug__) $(SUBDIRS:%=%/__clean__)
+
+# Automatic Dependencies
+
+deps: $(C_SRCS)
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIRS) $(C_SRCS) > $@
+
+-include deps
diff -urN CoolPlayerCVS-20030421-2130-orig/ogg/Makefile CoolPlayerCVS-20030421-2130/ogg/Makefile
--- CoolPlayerCVS-20030421-2130-orig/ogg/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ CoolPlayerCVS-20030421-2130/ogg/Makefile	2003-04-21 21:51:07.000000000 -0400
@@ -0,0 +1,54 @@
+# Standard Variables
+
+CC = winegcc
+AR = ar rc
+RM = rm -f
+RANLIB = ranlib
+CBASEFLAGS = -W -Wall $(INCDIRS) -mno-cygwin
+CPPBASEFLAGS = -D_LIB -DWIN32
+
+INCDIRS = -I./include
+OPTIMIZ = -O2
+STRIP = -s
+
+# Compilation flags
+
+CFLAGS = $(CBASEFLAGS) -g
+CPPFLAGS = $(CPPBASEFLAGS) -D_DEBUG
+
+# Main target
+
+BINDIR = .
+
+TARGET = $(BINDIR)/ogg_static.a
+
+C_SRCS = \
+	src/bitwise.c \
+	src/framing.c
+
+OBJS = $(C_SRCS:%.c=%.o)
+
+# Explicit rules
+%.o : %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCDIRS) -c -o $@ $<
+
+# Targets
+
+all: $(TARGET)
+
+debug: $(TARGET)
+
+$(TARGET): deps $(OBJS)
+	$(RM) $@
+	$(AR) $@ $(OBJS)
+	$(RANLIB) $@
+
+clean:
+	$(RM) $(TARGET) $(OBJS) deps
+
+# Automatic Dependencies
+
+deps: $(C_SRCS)
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIRS) $(C_SRCS) > $@
+
+-include deps
diff -urN CoolPlayerCVS-20030421-2130-orig/vorbis/Makefile CoolPlayerCVS-20030421-2130/vorbis/Makefile
--- CoolPlayerCVS-20030421-2130-orig/vorbis/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ CoolPlayerCVS-20030421-2130/vorbis/Makefile	2003-04-21 21:51:07.000000000 -0400
@@ -0,0 +1,87 @@
+# Standard Variables
+
+CC = winegcc
+AR = ar rc
+RM = rm -f
+RANLIB = ranlib
+CBASEFLAGS = -W -Wall $(INCDIRS) -mno-cygwin
+CPPBASEFLAGS = -D_LIB -DWIN32
+
+INCDIRS = -I./include -I../ogg/include
+OPTIMIZ = -O2
+STRIP = -s
+
+# Compilation flags
+
+CFLAGS = $(CBASEFLAGS) -g
+CPPFLAGS = $(CPPBASEFLAGS) -D_DEBUG
+
+# Main target
+
+BINDIR = .
+
+TARGETS = $(BINDIR)/vorbis_static.a $(BINDIR)/vorbisfile_static.a
+
+VORBIS_STATIC_C_SRCS = \
+	lib/analysis.c \
+	lib/bitrate.c \
+	lib/block.c \
+	lib/codebook.c \
+	lib/envelope.c \
+	lib/floor0.c \
+	lib/floor1.c \
+	lib/info.c \
+	lib/lpc.c \
+	lib/lsp.c \
+	lib/mapping0.c \
+	lib/mdct.c \
+	lib/psy.c \
+	lib/registry.c \
+	lib/res0.c \
+	lib/sharedbook.c \
+	lib/smallft.c \
+	lib/synthesis.c \
+	lib/window.c
+
+VORBISFILE_STATIC_C_SRCS = \
+	lib/vorbisfile.c
+
+C_SRCS = $(VORBIS_STATIC_C_SRCS) $(VORBISFILE_STATIC_C_SRCS)
+
+VORBIS_STATIC_OBJS = $(VORBIS_STATIC_C_SRCS:.c=.o)
+VORBISFILE_STATIC_OBJS = $(VORBISFILE_STATIC_C_SRCS:.c=.o)
+
+OBJS = $(VORBIS_STATIC_OBJS) $(VORBISFILE_STATIC_OBJS)
+
+# Explicit rules
+%.o : %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCDIRS) -c -o $@ $<
+
+# Targets
+
+all: $(TARGETS)
+
+debug: $(TARGETS)
+
+$(BINDIR)/vorbis_static.a: deps-vorbis-static $(VORBIS_STATIC_OBJS)
+	$(RM) $@
+	$(AR) $@ $(VORBIS_STATIC_OBJS)
+	$(RANLIB) $@
+
+$(BINDIR)/vorbisfile_static.a: deps-vorbisfile-static $(VORBISFILE_STATIC_OBJS)
+	$(RM) $@
+	$(AR) $@ $(VORBISFILE_STATIC_OBJS)
+	$(RANLIB) $@
+
+clean:
+	$(RM) $(TARGETS) $(OBJS) deps-vorbis-static deps-vorbisfile-static
+
+# Automatic Dependencies
+
+deps-vorbis-static: $(VORBIS_STATIC_C_SRCS)
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIRS) $(VORBIS_STATIC_C_SRCS) > $@
+deps-vorbisfile-static: $(VORBISFILE_STATIC_C_SRCS)
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIRS) $(VORBISFILE_STATIC_C_SRCS) > $@
+
+-include deps-vorbis-static
+-include deps-vorbisfile-static
diff -urN CoolPlayerCVS-20030421-2130-orig/CompositeFile.c CoolPlayerCVS-20030421-2130/CompositeFile.c
--- CoolPlayerCVS-20030421-2130-orig/CompositeFile.c	2003-04-20 15:50:11.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/CompositeFile.c	2003-04-21 21:51:07.000000000 -0400
@@ -23,7 +23,7 @@
 #include "stdafx.h"
 #include "globals.h"
 #include "CompositeFile.h"
-#include "Zlib/zlib.h"
+#include "ZLib/zlib.h"
 
 
 #define CPC_PKFILE_MAGIC		0x04034B50
diff -urN CoolPlayerCVS-20030421-2130-orig/CPI_Player_Callbacks.c CoolPlayerCVS-20030421-2130/CPI_Player_Callbacks.c
--- CoolPlayerCVS-20030421-2130-orig/CPI_Player_Callbacks.c	2003-04-20 15:50:08.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/CPI_Player_Callbacks.c	2003-04-21 21:51:07.000000000 -0400
@@ -23,8 +23,8 @@
 #include "stdafx.h"
 #include "globals.h"
 #include "CPI_Player.h"
-#include "CPI_PlayList.h"
-#include "CPI_PlayListItem.h"
+#include "CPI_Playlist.h"
+#include "CPI_PlaylistItem.h"
 
 
 ////////////////////////////////////////////////////////////////////////////////
diff -urN CoolPlayerCVS-20030421-2130-orig/stdafx.h CoolPlayerCVS-20030421-2130/stdafx.h
--- CoolPlayerCVS-20030421-2130-orig/stdafx.h	2003-04-16 21:50:19.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/stdafx.h	2003-04-21 21:51:07.000000000 -0400
@@ -4,14 +4,14 @@
 #define _WIN32_WINDOWS 0x0410 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-// #include "AggressiveOptimize.h"
+// #include "aggressiveoptimize.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 #include <limits.h>
 #include "debug.h"
 #include <process.h>
-#include <Wininet.h>
+#include <wininet.h>
 #include <search.h>
 #include <malloc.h>
 #include <time.h>
diff -urN CoolPlayerCVS-20030421-2130-orig/skin.h CoolPlayerCVS-20030421-2130/skin.h
--- CoolPlayerCVS-20030421-2130-orig/skin.h	2003-04-17 10:27:15.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/skin.h	2003-04-21 21:51:07.000000000 -0400
@@ -58,7 +58,7 @@
 typedef struct
 {
     char    name[128];
-    enum Obects Object;
+    enum Objects Object;
 }
 Associate;
 
diff -urN CoolPlayerCVS-20030421-2130-orig/globals.h CoolPlayerCVS-20030421-2130/globals.h
--- CoolPlayerCVS-20030421-2130-orig/globals.h	2003-04-21 21:25:35.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/globals.h	2003-04-21 21:51:07.000000000 -0400
@@ -321,7 +321,7 @@
 void    main_draw_vu_from_mouse(HWND hWnd, int vunummer, int vuwaarde);
 void    main_draw_vu_from_value(HWND hWnd, int vunummer, int vuwaarde);
 void    main_menuproc(HWND hWnd, LPPOINT points);
-void    main_play(HWND hWnd, BOOL Nogap, enum PlayWhat playwhat);
+//void    main_play(HWND hWnd, BOOL Nogap, enum PlayWhat playwhat);
 void    main_reset_window(HWND hWnd);
 void    main_set_eq(void);
 void    main_skin_add_to_menu(char *name);
diff -urN CoolPlayerCVS-20030421-2130-orig/debug.h CoolPlayerCVS-20030421-2130/debug.h
--- CoolPlayerCVS-20030421-2130-orig/debug.h	2001-08-17 10:38:35.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/debug.h	2003-04-21 21:51:07.000000000 -0400
@@ -28,10 +28,10 @@
 #define CP_TRACE4(format, arg1, arg2, arg3, arg4) _CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL, format "\n", arg1, arg2, arg3, arg4)
 #define CP_TRACE5(format, arg1, arg2, arg3, arg4, arg5) _CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL, format "\n", arg1, arg2, arg3, arg4, arg5)
 //
-#define CP_ASSERT(expr) if(!(expr)) { CP_TRACE1("ASSERTION %s FAILS", #expr); __asm { int 3 }  }
-#define CP_FAIL(errstring) { CP_TRACE1("HARD FAILURE %s", #errstring); __asm { int 3 } }
+#define CP_ASSERT(expr) if(!(expr)) { CP_TRACE1("ASSERTION %s FAILS", #expr); __asm__("int $3");  }
+#define CP_FAIL(errstring) { CP_TRACE1("HARD FAILURE %s", #errstring); __asm__("int $3"); }
 //
-#define CP_CHECKOBJECT(obj_ptr_typed) if(!obj_ptr_typed || !_CrtIsMemoryBlock(obj_ptr_typed, sizeof(*obj_ptr_typed), NULL, NULL, NULL)) { CP_TRACE1("POINTER %s is Bogus", #obj_ptr_typed); __asm { int 3 } }
+#define CP_CHECKOBJECT(obj_ptr_typed) if(!obj_ptr_typed || !_CrtIsMemoryBlock(obj_ptr_typed, sizeof(*obj_ptr_typed), NULL, NULL, NULL)) { CP_TRACE1("POINTER %s is Bogus", #obj_ptr_typed); __asm__("int $3"); }
 
 
 
diff -urN CoolPlayerCVS-20030421-2130-orig/ogg/include/ogg/os_types.h CoolPlayerCVS-20030421-2130/ogg/include/ogg/os_types.h
--- CoolPlayerCVS-20030421-2130-orig/ogg/include/ogg/os_types.h	2003-04-12 11:29:28.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/ogg/include/ogg/os_types.h	2003-04-21 21:51:07.000000000 -0400
@@ -34,13 +34,21 @@
    typedef __int16 ogg_int16_t;
    typedef unsigned __int16 ogg_uint16_t;
 #  else
-   /* Cygwin */
-   #include <_G_config.h>
-   typedef _G_int64_t ogg_int64_t;
-   typedef _G_int32_t ogg_int32_t;
-   typedef _G_uint32_t ogg_uint32_t;
-   typedef _G_int16_t ogg_int16_t;
-   typedef _G_uint16_t ogg_uint16_t;
+#    ifdef __CYGWIN__
+     /* Cygwin */
+     #include <_G_config.h>
+     typedef _G_int64_t ogg_int64_t;
+     typedef _G_int32_t ogg_int32_t;
+     typedef _G_uint32_t ogg_uint32_t;
+     typedef _G_int16_t ogg_int16_t;
+     typedef _G_uint16_t ogg_uint16_t;
+#    else
+     /* mingw */
+     typedef long long ogg_int64_t;
+     typedef int ogg_int32_t;
+     typedef unsigned int ogg_uint32_t;
+     typedef short ogg_int16_t;
+#    endif
 #  endif
 
 #elif defined(__MACOS__)
diff -urN CoolPlayerCVS-20030421-2130-orig/afxres.h CoolPlayerCVS-20030421-2130/afxres.h
--- CoolPlayerCVS-20030421-2130-orig/afxres.h	1969-12-31 19:00:00.000000000 -0500
+++ CoolPlayerCVS-20030421-2130/afxres.h	2003-04-21 21:51:07.000000000 -0400
@@ -0,0 +1 @@
+#include "winres.h"
diff -urN CoolPlayerCVS-20030421-2130-orig/CPI_Player_CoDec_WAV.c CoolPlayerCVS-20030421-2130/CPI_Player_CoDec_WAV.c
--- CoolPlayerCVS-20030421-2130-orig/CPI_Player_CoDec_WAV.c	2003-04-20 15:50:08.000000000 -0400
+++ CoolPlayerCVS-20030421-2130/CPI_Player_CoDec_WAV.c	2003-04-21 21:51:07.000000000 -0400
@@ -272,6 +272,7 @@
 {
     unsigned int iSeekPos;
     div_t progress;
+    long long temp;
     CPs_CoDec_Wave *pContext = (CPs_CoDec_Wave*)pModule->m_pModuleCookie;
     CP_CHECKOBJECT(pContext);
 
@@ -283,7 +284,9 @@
     iSeekPos &= ~0x3;
 
     // Setup our progress
-    progress = div(iSeekPos, pContext->m_iBytesPerSecond);
+    temp = div(iSeekPos, pContext->m_iBytesPerSecond);
+    progress.quot = ((int) (temp & 0xffffffffULL));
+    progress.rem = ((int) ((unsigned long long) temp)) >> 32;
     pContext->m_iCurrentOffset_Secs = progress.quot;
     pContext->m_iCurrentOffset_Fraction_Bytes = progress.rem;
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux