mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 22:48:55 +02:00
259 lines
10 KiB
Plaintext
259 lines
10 KiB
Plaintext
From 05dd48adcca1be839f7099770e22109062a01de6 Mon Sep 17 00:00:00 2001
|
|
From: Robert Kausch <robert.kausch@freac.org>
|
|
Date: Sat, 3 Nov 2018 18:31:20 +0100
|
|
Subject: Fixes for building on Haiku.
|
|
|
|
|
|
diff --git a/Shared/All.h b/Shared/All.h
|
|
index b34d3b1..12d7a89 100644
|
|
--- a/Shared/All.h
|
|
+++ b/Shared/All.h
|
|
@@ -57,7 +57,9 @@ Global compiler settings (useful for porting)
|
|
*****************************************************************************************/
|
|
// assembly code (helps performance, but limits portability)
|
|
#if !defined(PLATFORM_ARM) && !defined(PLATFORM_ANDROID)
|
|
- #define ENABLE_SSE_ASSEMBLY
|
|
+ #ifdef __SSE2__
|
|
+ #define ENABLE_SSE_ASSEMBLY
|
|
+ #endif
|
|
#ifdef _MSC_VER // doesn't compile in gcc
|
|
#ifndef PLATFORM_x64
|
|
#define ENABLE_MMX_ASSEMBLY
|
|
diff --git a/Shared/MACDll.h b/Shared/MACDll.h
|
|
index e7eb619..487d5e8 100644
|
|
--- a/Shared/MACDll.h
|
|
+++ b/Shared/MACDll.h
|
|
@@ -30,15 +30,19 @@ Helper functions
|
|
extern "C"
|
|
{
|
|
DLLEXPORT int __stdcall GetVersionNumber();
|
|
+#ifdef PLATFORM_WINDOWS
|
|
DLLEXPORT int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure = TRUE, HWND hwndParent = NULL);
|
|
DLLEXPORT int __stdcall ShowFileInfoDialog(const APE::str_ansi * pFilename, HWND hwndWindow);
|
|
+#endif
|
|
DLLEXPORT int __stdcall TagFileSimple(const APE::str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3);
|
|
DLLEXPORT int __stdcall GetID3Tag(const APE::str_ansi * pFilename, APE::ID3_TAG * pID3Tag);
|
|
DLLEXPORT int __stdcall RemoveTag(const APE::str_ansi * pFilename);
|
|
}
|
|
|
|
typedef int (__stdcall * proc_GetVersionNumber)();
|
|
+#ifdef PLATFORM_WINDOWS
|
|
typedef int (__stdcall * proc_GetInterfaceCompatibility)(int, BOOL, HWND);
|
|
+#endif
|
|
|
|
/*****************************************************************************************
|
|
IAPECompress wrapper(s)
|
|
diff --git a/Shared/NoWindows.h b/Shared/NoWindows.h
|
|
index d188ee0..a0f4116 100644
|
|
--- a/Shared/NoWindows.h
|
|
+++ b/Shared/NoWindows.h
|
|
@@ -32,6 +32,9 @@ typedef long LRESULT;
|
|
|
|
#define ZeroMemory(POINTER, BYTES) memset(POINTER, 0, BYTES);
|
|
|
|
+#define TRUE true
|
|
+#define FALSE false
|
|
+
|
|
#define CALLBACK
|
|
|
|
#define _T(x) L ## x
|
|
diff --git a/Source/Console/Console.cpp b/Source/Console/Console.cpp
|
|
index b990169..ee30b30 100644
|
|
--- a/Source/Console/Console.cpp
|
|
+++ b/Source/Console/Console.cpp
|
|
@@ -20,6 +20,15 @@ using namespace APE;
|
|
#define CONVERT_MODE 3
|
|
#define UNDEFINED_MODE -1
|
|
|
|
+#define _tmain main
|
|
+#define _tcscpy strcpy
|
|
+#define _tcsncpy strncpy
|
|
+#define _tcsnicmp strncasecmp
|
|
+#define _ftprintf fprintf
|
|
+#define _ttoi atoi
|
|
+#define TCHAR char
|
|
+#define _T(x) x
|
|
+
|
|
// global variables
|
|
TICK_COUNT_TYPE g_nInitialTickCount = 0;
|
|
|
|
@@ -89,13 +98,8 @@ int _tmain(int argc, TCHAR * argv[])
|
|
}
|
|
|
|
// store the filenames
|
|
- #ifdef _UNICODE
|
|
- spInputFilename.Assign(argv[1], TRUE, FALSE);
|
|
- spOutputFilename.Assign(argv[2], TRUE, FALSE);
|
|
- #else
|
|
- spInputFilename.Assign(CAPECharacterHelper::GetUTF16FromANSI(argv[1]), TRUE);
|
|
- spOutputFilename.Assign(CAPECharacterHelper::GetUTF16FromANSI(argv[2]), TRUE);
|
|
- #endif
|
|
+ spInputFilename.Assign(CAPECharacterHelper::GetUTF16FromUTF8((str_utf8*) argv[1]), TRUE);
|
|
+ spOutputFilename.Assign(CAPECharacterHelper::GetUTF16FromUTF8((str_utf8*) argv[2]), TRUE);
|
|
|
|
// verify that the input file exists
|
|
if (!FileExists(spInputFilename))
|
|
diff --git a/Source/MACDll/MACDll.cpp b/Source/MACDll/MACDll.cpp
|
|
index 0d74e64..cb5c4d5 100644
|
|
--- a/Source/MACDll/MACDll.cpp
|
|
+++ b/Source/MACDll/MACDll.cpp
|
|
@@ -1,9 +1,16 @@
|
|
-#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "MACDll.h"
|
|
+
|
|
+using namespace APE;
|
|
+
|
|
+#ifdef PLATFORM_WINDOWS
|
|
#include "WinFileIO.h"
|
|
#include "APEInfoDialog.h"
|
|
#include "WAVInfoDialog.h"
|
|
+#else
|
|
+#include "StdLibFileIO.h"
|
|
+#endif
|
|
+
|
|
#include "APEDecompress.h"
|
|
#include "APECompressCreate.h"
|
|
#include "APECompressCore.h"
|
|
@@ -17,6 +24,7 @@ int __stdcall GetVersionNumber()
|
|
return MAC_FILE_VERSION_NUMBER;
|
|
}
|
|
|
|
+#ifdef PLATFORM_WINDOWS
|
|
int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure, HWND hwndParent)
|
|
{
|
|
int nRetVal = 0;
|
|
@@ -26,7 +34,7 @@ int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFai
|
|
if (bDisplayWarningsOnFailure)
|
|
{
|
|
TCHAR cMessage[1024];
|
|
- _stprintf_s(cMessage, 1024, _T("You system does not have a new enough version of Monkey's Audio installed.\n")
|
|
+ _stprintf(cMessage, _T("You system does not have a new enough version of Monkey's Audio installed.\n")
|
|
_T("Please visit www.monkeysaudio.com for the latest version.\n\n(version %.2f or later required)"),
|
|
float(nVersion) / float(1000));
|
|
MessageBox(hwndParent, cMessage, _T("Please Update Monkey's Audio"), MB_OK | MB_ICONINFORMATION);
|
|
@@ -38,7 +46,7 @@ int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFai
|
|
if (bDisplayWarningsOnFailure)
|
|
{
|
|
TCHAR cMessage[1024];
|
|
- _stprintf_s(cMessage, 1024, _T("This program is trying to use an old version of Monkey's Audio.\n")
|
|
+ _stprintf(cMessage, _T("This program is trying to use an old version of Monkey's Audio.\n")
|
|
_T("Please contact the author about updating their support for Monkey's Audio.\n\n")
|
|
_T("Monkey's Audio currently installed: %.2f\nProgram is searching for: %.2f"),
|
|
float(MAC_FILE_VERSION_NUMBER) / float(1000), float(nVersion) / float(1000));
|
|
@@ -48,7 +56,9 @@ int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFai
|
|
|
|
return nRetVal;
|
|
}
|
|
+#endif
|
|
|
|
+#ifdef _MSC_VER
|
|
int __stdcall ShowFileInfoDialog(const str_ansi * pFilename, HWND hwndWindow)
|
|
{
|
|
// convert the filename
|
|
@@ -87,6 +97,7 @@ int __stdcall ShowFileInfoDialog(const str_ansi * pFilename, HWND hwndWindow)
|
|
return 0;
|
|
};
|
|
}
|
|
+#endif
|
|
|
|
int __stdcall TagFileSimple(const str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3)
|
|
{
|
|
diff --git a/Source/MACDll/MACDll.h b/Source/MACDll/MACDll.h
|
|
index e7eb619..487d5e8 100644
|
|
--- a/Source/MACDll/MACDll.h
|
|
+++ b/Source/MACDll/MACDll.h
|
|
@@ -30,15 +30,19 @@ Helper functions
|
|
extern "C"
|
|
{
|
|
DLLEXPORT int __stdcall GetVersionNumber();
|
|
+#ifdef PLATFORM_WINDOWS
|
|
DLLEXPORT int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure = TRUE, HWND hwndParent = NULL);
|
|
DLLEXPORT int __stdcall ShowFileInfoDialog(const APE::str_ansi * pFilename, HWND hwndWindow);
|
|
+#endif
|
|
DLLEXPORT int __stdcall TagFileSimple(const APE::str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3);
|
|
DLLEXPORT int __stdcall GetID3Tag(const APE::str_ansi * pFilename, APE::ID3_TAG * pID3Tag);
|
|
DLLEXPORT int __stdcall RemoveTag(const APE::str_ansi * pFilename);
|
|
}
|
|
|
|
typedef int (__stdcall * proc_GetVersionNumber)();
|
|
+#ifdef PLATFORM_WINDOWS
|
|
typedef int (__stdcall * proc_GetInterfaceCompatibility)(int, BOOL, HWND);
|
|
+#endif
|
|
|
|
/*****************************************************************************************
|
|
IAPECompress wrapper(s)
|
|
diff --git a/Source/MACLib/WAVInputSource.cpp b/Source/MACLib/WAVInputSource.cpp
|
|
index a4f2eef..acbce21 100644
|
|
--- a/Source/MACLib/WAVInputSource.cpp
|
|
+++ b/Source/MACLib/WAVInputSource.cpp
|
|
@@ -9,8 +9,8 @@ namespace APE
|
|
|
|
struct RIFF_HEADER
|
|
{
|
|
- char cRIFF[4]; // the characters 'RIFF' indicating that it's a RIFF file
|
|
- unsigned long nBytes; // the number of bytes following this header
|
|
+ char cRIFF[4]; // the characters 'RIFF' indicating that it's a RIFF file
|
|
+ uint32 nBytes; // the number of bytes following this header
|
|
};
|
|
|
|
struct DATA_TYPE_ID_HEADER
|
|
@@ -20,18 +20,18 @@ struct DATA_TYPE_ID_HEADER
|
|
|
|
struct WAV_FORMAT_HEADER
|
|
{
|
|
- unsigned short nFormatTag; // the format of the WAV...should equal 1 for a PCM file
|
|
- unsigned short nChannels; // the number of channels
|
|
- unsigned long nSamplesPerSecond; // the number of samples per second
|
|
- unsigned long nBytesPerSecond; // the bytes per second
|
|
- unsigned short nBlockAlign; // block alignment
|
|
- unsigned short nBitsPerSample; // the number of bits per sample
|
|
+ uint16 nFormatTag; // the format of the WAV...should equal 1 for a PCM file
|
|
+ uint16 nChannels; // the number of channels
|
|
+ uint32 nSamplesPerSecond; // the number of samples per second
|
|
+ uint32 nBytesPerSecond; // the bytes per second
|
|
+ uint16 nBlockAlign; // block alignment
|
|
+ uint16 nBitsPerSample; // the number of bits per sample
|
|
};
|
|
|
|
struct RIFF_CHUNK_HEADER
|
|
{
|
|
- char cChunkLabel[4]; // should equal "data" indicating the data chunk
|
|
- unsigned long nChunkBytes; // the bytes of the chunk
|
|
+ char cChunkLabel[4]; // should equal "data" indicating the data chunk
|
|
+ uint32 nChunkBytes; // the bytes of the chunk
|
|
};
|
|
|
|
|
|
diff --git a/Source/Shared/All.h b/Source/Shared/All.h
|
|
index b34d3b1..12d7a89 100644
|
|
--- a/Source/Shared/All.h
|
|
+++ b/Source/Shared/All.h
|
|
@@ -57,7 +57,9 @@ Global compiler settings (useful for porting)
|
|
*****************************************************************************************/
|
|
// assembly code (helps performance, but limits portability)
|
|
#if !defined(PLATFORM_ARM) && !defined(PLATFORM_ANDROID)
|
|
- #define ENABLE_SSE_ASSEMBLY
|
|
+ #ifdef __SSE2__
|
|
+ #define ENABLE_SSE_ASSEMBLY
|
|
+ #endif
|
|
#ifdef _MSC_VER // doesn't compile in gcc
|
|
#ifndef PLATFORM_x64
|
|
#define ENABLE_MMX_ASSEMBLY
|
|
diff --git a/Source/Shared/NoWindows.h b/Source/Shared/NoWindows.h
|
|
index d188ee0..a0f4116 100644
|
|
--- a/Source/Shared/NoWindows.h
|
|
+++ b/Source/Shared/NoWindows.h
|
|
@@ -32,6 +32,9 @@ typedef long LRESULT;
|
|
|
|
#define ZeroMemory(POINTER, BYTES) memset(POINTER, 0, BYTES);
|
|
|
|
+#define TRUE true
|
|
+#define FALSE false
|
|
+
|
|
#define CALLBACK
|
|
|
|
#define _T(x) L ## x
|
|
--
|
|
2.19.1
|