mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- fixed compilation on Windows.
This commit is contained in:
parent
2b87941d7d
commit
83e8e5535d
6 changed files with 67 additions and 54 deletions
|
@ -38,7 +38,7 @@ elseif( FLUIDSYNTH_FOUND )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../libraries/dumb/include" "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" "${OPLSYNTH_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" )
|
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../libraries/dumb/include" "${ZLIB_INCLUDE_DIR}" "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" "${OPLSYNTH_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set( PLAT_SOURCES
|
set( PLAT_SOURCES
|
||||||
|
@ -53,6 +53,7 @@ file( GLOB HEADER_FILES
|
||||||
mididevices/*.h
|
mididevices/*.h
|
||||||
midisources/*.h
|
midisources/*.h
|
||||||
musicformats/*.h
|
musicformats/*.h
|
||||||
|
musicformats/win32/*.h
|
||||||
decoder/*.h
|
decoder/*.h
|
||||||
streamsources/*.h
|
streamsources/*.h
|
||||||
thirdparty/*.h
|
thirdparty/*.h
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include "zmusic/m_swap.h"
|
#include "zmusic/m_swap.h"
|
||||||
#include "i_cd.h"
|
#include "win32/i_cd.h"
|
||||||
|
|
||||||
|
|
||||||
// CD track/disk played through the multimedia system -----------------------
|
// CD track/disk played through the multimedia system -----------------------
|
||||||
|
@ -126,7 +126,7 @@ CDSong::CDSong (int track, int id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = CD_Init ();
|
success = CD_Init (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success && (track == 0 || CD_CheckTrack (track)))
|
if (success && (track == 0 || CD_CheckTrack (track)))
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <assert.h>
|
||||||
#include "zmusic/musinfo.h"
|
#include "zmusic/musinfo.h"
|
||||||
#include "mididevices/mididevice.h"
|
#include "mididevices/mididevice.h"
|
||||||
#include "midisources/midisource.h"
|
#include "midisources/midisource.h"
|
||||||
|
|
|
@ -36,16 +36,8 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "doomtype.h"
|
|
||||||
#include "c_cvars.h"
|
|
||||||
#include "m_argv.h"
|
|
||||||
#include "version.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
|
|
||||||
#include "i_cd.h"
|
|
||||||
#include "helperthread.h"
|
#include "helperthread.h"
|
||||||
#include "atterm.h"
|
#include "i_cd.h"
|
||||||
|
|
||||||
extern HWND Window;
|
extern HWND Window;
|
||||||
extern HINSTANCE g_hInst;
|
extern HINSTANCE g_hInst;
|
||||||
|
@ -101,36 +93,7 @@ protected:
|
||||||
|
|
||||||
static FCDThread *CDThread;
|
static FCDThread *CDThread;
|
||||||
static int Inited = NOT_INITED;
|
static int Inited = NOT_INITED;
|
||||||
|
static int Enabled = false;
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CVAR: cd_enabled
|
|
||||||
//
|
|
||||||
// Use the CD device? Can be overridden with -nocdaudio on the command line
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
CUSTOM_CVAR (Bool, cd_enabled, true, CVAR_ARCHIVE|CVAR_NOINITCALL|CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
if (self)
|
|
||||||
CD_Init ();
|
|
||||||
else
|
|
||||||
CD_Close ();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CVAR: cd_drive
|
|
||||||
//
|
|
||||||
// Which drive (letter) to use for CD audio. If not a valid drive letter,
|
|
||||||
// let the operating system decide for us.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
CUSTOM_CVAR (String, cd_drive, "", CVAR_ARCHIVE|CVAR_NOINITCALL|CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
CD_Init ();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -173,7 +136,7 @@ bool FCDThread::Init ()
|
||||||
CD_WindowClass.style = CS_NOCLOSE;
|
CD_WindowClass.style = CS_NOCLOSE;
|
||||||
CD_WindowClass.lpfnWndProc = CD_WndProc;
|
CD_WindowClass.lpfnWndProc = CD_WndProc;
|
||||||
CD_WindowClass.hInstance = g_hInst;
|
CD_WindowClass.hInstance = g_hInst;
|
||||||
CD_WindowClass.lpszClassName = WGAMENAME " CD Player";
|
CD_WindowClass.lpszClassName = L"ZNusic CD Player";
|
||||||
CD_WindowAtom = RegisterClass (&CD_WindowClass);
|
CD_WindowAtom = RegisterClass (&CD_WindowClass);
|
||||||
|
|
||||||
if (CD_WindowAtom == 0)
|
if (CD_WindowAtom == 0)
|
||||||
|
@ -181,7 +144,7 @@ bool FCDThread::Init ()
|
||||||
|
|
||||||
CD_Window = CreateWindow (
|
CD_Window = CreateWindow (
|
||||||
(LPCTSTR)(INT_PTR)(int)CD_WindowAtom,
|
(LPCTSTR)(INT_PTR)(int)CD_WindowAtom,
|
||||||
WGAMENAME " CD Player",
|
CD_WindowClass.lpszClassName,
|
||||||
0,
|
0,
|
||||||
0, 0, 10, 10,
|
0, 0, 10, 10,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -453,8 +416,16 @@ static void KillThread ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool CD_Init ()
|
bool CD_Enable (const char *cd_drive)
|
||||||
{
|
{
|
||||||
|
if (!cd_drive)
|
||||||
|
{
|
||||||
|
// lock the CD system.
|
||||||
|
Enabled = false;
|
||||||
|
CD_Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Enabled = true; // this must have been called at least once to consider the use of the CD system
|
||||||
if ((cd_drive)[0] == 0 || (cd_drive)[1] != 0)
|
if ((cd_drive)[0] == 0 || (cd_drive)[1] != 0)
|
||||||
{
|
{
|
||||||
return CD_Init (-1);
|
return CD_Init (-1);
|
||||||
|
@ -463,21 +434,22 @@ bool CD_Init ()
|
||||||
{
|
{
|
||||||
char drive = toupper ((cd_drive)[0]);
|
char drive = toupper ((cd_drive)[0]);
|
||||||
|
|
||||||
if (drive >= 'A' && drive <= 'Z' && !CD_Init (drive - 'A'))
|
if (drive >= 'A' && drive <= 'Z' && !CD_Init(drive - 'A'))
|
||||||
return CD_Init (-1);
|
{
|
||||||
|
return CD_Init(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CD_Init (int device)
|
bool CD_Init (int device)
|
||||||
{
|
{
|
||||||
if (!cd_enabled || Args->CheckParm ("-nocdaudio"))
|
if (!Enabled) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (CDThread == NULL)
|
if (CDThread == NULL)
|
||||||
{
|
{
|
||||||
CDThread = new FCDThread;
|
CDThread = new FCDThread;
|
||||||
atterm (KillThread);
|
atexit (KillThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Inited != device)
|
if (Inited != device)
|
||||||
|
|
|
@ -48,8 +48,8 @@ enum ECDModes
|
||||||
// Opens a CD device. If device is non-negative, it specifies which device
|
// Opens a CD device. If device is non-negative, it specifies which device
|
||||||
// to open. 0 is drive A:, 1 is drive B:, etc. If device is not specified,
|
// to open. 0 is drive A:, 1 is drive B:, etc. If device is not specified,
|
||||||
// the user's preference is used to decide which device to open.
|
// the user's preference is used to decide which device to open.
|
||||||
bool CD_Init ();
|
bool CD_Enable (const char *drive);
|
||||||
bool CD_Init (int device);
|
bool CD_Init (int device = -1);
|
||||||
|
|
||||||
// Open a CD device containing a specific CD. Tries device guess first.
|
// Open a CD device containing a specific CD. Tries device guess first.
|
||||||
bool CD_InitID (unsigned int id, int guess=-1);
|
bool CD_InitID (unsigned int id, int guess=-1);
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void I_InitSoundFonts();
|
void I_InitSoundFonts();
|
||||||
|
|
||||||
extern MusPlayingInfo mus_playing;
|
extern MusPlayingInfo mus_playing;
|
||||||
|
@ -74,6 +73,45 @@ static bool ungzip(uint8_t *data, int size, std::vector<uint8_t> &newdata);
|
||||||
|
|
||||||
int nomusic = 0;
|
int nomusic = 0;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
void I_InitMusicWin32();
|
||||||
|
|
||||||
|
#include "musicformats/win32/i_cd.h"
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// CVAR: cd_drive
|
||||||
|
//
|
||||||
|
// Which drive (letter) to use for CD audio. If not a valid drive letter,
|
||||||
|
// let the operating system decide for us.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
EXTERN_CVAR(Bool, cd_enabled);
|
||||||
|
|
||||||
|
CUSTOM_CVAR(String, cd_drive, "", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||||
|
{
|
||||||
|
if (cd_enabled && !Args->CheckParm("-nocdaudio")) CD_Enable(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// CVAR: cd_enabled
|
||||||
|
//
|
||||||
|
// Use the CD device? Can be overridden with -nocdaudio on the command line
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Bool, cd_enabled, true, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||||
|
{
|
||||||
|
if (self && !Args->CheckParm("-nocdaudio"))
|
||||||
|
CD_Enable(cd_drive);
|
||||||
|
else
|
||||||
|
CD_Enable(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// CVAR snd_musicvolume
|
// CVAR snd_musicvolume
|
||||||
|
@ -299,7 +337,7 @@ void I_SetRelativeVolume(float vol)
|
||||||
void I_SetMusicVolume (double factor)
|
void I_SetMusicVolume (double factor)
|
||||||
{
|
{
|
||||||
factor = clamp(factor, 0., 2.0);
|
factor = clamp(factor, 0., 2.0);
|
||||||
I_SetRelativeVolume(factor);
|
I_SetRelativeVolume((float)factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue