Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
port sound and music
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Oct 4, 2023
1 parent 704162f commit fb58589
Show file tree
Hide file tree
Showing 22 changed files with 1,267 additions and 151 deletions.
156 changes: 78 additions & 78 deletions docs/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 35 additions & 35 deletions docs/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ typedef struct CINE_FRAME {
004473B0 0000007F -R bool __cdecl WinInputInit(void);
00447430 00000024 -R bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList);
00447460 000000E8 -R BOOL __stdcall DInputEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef);
00447550 0000001F + void __thiscall S_FlaggedString_Create(struct STRING_FLAGGED *string, DWORD size);
00447550 0000001F + void __thiscall S_FlaggedString_Create(struct STRING_FLAGGED *string, int32_t size);
00447570 0000004E -R JOYSTICK_NODE *__cdecl GetJoystick(GUID *lpGuid);
004475C0 000000C9 -R void __cdecl DInputKeyboardCreate(void);
00447690 00000029 -R void __cdecl DInputKeyboardRelease(void);
Expand All @@ -1854,24 +1854,24 @@ typedef struct CINE_FRAME {
00447B30 00000018 x sub_447B30
00447B40 00000039 x sub_447B40
00447B90 0000002F x sub_447B90
00447BC0 00000048 - struct SOUND_ADAPTER_NODE *__cdecl S_Audio_Sample_GetAdapter(GUID *guid);
00447C10 0000002E - void __cdecl S_Audio_Sample_CloseAllTracks(void);
00447C40 0000010E - bool __cdecl S_Audio_Sample_Load(int32_t sample_id, LPWAVEFORMATEX format, const void *data, int32_t data_size);
00447D50 00000045 - bool __cdecl S_Audio_Sample_IsTrackPlaying(int32_t track_id);
00447DA0 000000E7 - int32_t __cdecl S_Audio_Sample_Play(int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan, int32_t flags);
00447E90 00000039 - int32_t __cdecl S_Audio_Sample_GetFreeTrackIndex(void);
00447ED0 0000002C - void __cdecl S_Audio_Sample_AdjustTrackVolumeAndPan(int32_t track_id, int32_t volume, int32_t pan);
00447F00 00000031 - void __cdecl S_Audio_Sample_AdjustTrackPitch(int32_t track_id, int32_t pitch);
00447F40 0000002F - void __cdecl S_Audio_Sample_CloseTrack(int32_t track_id);
00447FA0 00000005 -R sub_447FA0
00447FB0 0000009C - bool __cdecl S_Audio_Sample_Init(void);
00448050 0000001A - bool __cdecl S_Audio_Sample_DSoundEnumerate(struct SOUND_ADAPTER_LIST *adapter_list);
00448070 000000E2 - BOOL __stdcall S_Audio_Sample_DSoundEnumCallback(LPGUID guid, LPCTSTR description, LPCTSTR module, LPVOID context);
00448160 0000017C - void __cdecl S_Audio_Sample_Init2(HWND hwnd);
004482E0 0000001C - bool __cdecl S_Audio_Sample_DSoundCreate(GUID *guid);
00448300 000000C4 - bool __cdecl S_Audio_Sample_DSoundBufferTest(void);
004483D0 0000002A - void __cdecl S_Audio_Sample_Shutdown(void);
00448400 00000006 - bool __cdecl S_Audio_Sample_IsEnabled(void);
00447BC0 00000048 + struct SOUND_ADAPTER_NODE *__cdecl S_Audio_Sample_GetAdapter(GUID *guid);
00447C10 0000002E + void __cdecl S_Audio_Sample_CloseAllTracks(void);
00447C40 0000010E + bool __cdecl S_Audio_Sample_Load(int32_t sample_id, LPWAVEFORMATEX format, const void *data, int32_t data_size);
00447D50 00000045 + bool __cdecl S_Audio_Sample_IsTrackPlaying(int32_t track_id);
00447DA0 000000E7 + int32_t __cdecl S_Audio_Sample_Play(int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan, int32_t flags);
00447E90 00000039 + int32_t __cdecl S_Audio_Sample_GetFreeTrackIndex(void);
00447ED0 0000002C + void __cdecl S_Audio_Sample_AdjustTrackVolumeAndPan(int32_t track_id, int32_t volume, int32_t pan);
00447F00 00000031 + void __cdecl S_Audio_Sample_AdjustTrackPitch(int32_t track_id, int32_t pitch);
00447F40 0000002F + void __cdecl S_Audio_Sample_CloseTrack(int32_t track_id);
00447FA0 00000005 +R sub_447FA0
00447FB0 0000009C + bool __cdecl S_Audio_Sample_Init(void);
00448050 0000001A + bool __cdecl S_Audio_Sample_DSoundEnumerate(struct SOUND_ADAPTER_LIST *adapter_list);
00448070 000000E2 + BOOL __stdcall S_Audio_Sample_DSoundEnumCallback(LPGUID guid, LPCTSTR description, LPCTSTR module, LPVOID context);
00448160 0000017C + void __cdecl S_Audio_Sample_Init2(HWND hwnd);
004482E0 0000001C + bool __cdecl S_Audio_Sample_DSoundCreate(GUID *guid);
00448300 000000C4 + bool __cdecl S_Audio_Sample_DSoundBufferTest(void);
004483D0 0000002A + void __cdecl S_Audio_Sample_Shutdown(void);
00448400 00000006 + bool __cdecl S_Audio_Sample_IsEnabled(void);
00448410 00000005 -R sub_448410
00448420 00000001 -R sub_448420
00448430 0000013B -R void __cdecl CreateScreenBuffers(void);
Expand Down Expand Up @@ -2071,23 +2071,23 @@ typedef struct CINE_FRAME {
00454D60 0000032D -R void __cdecl CheckCheatMode(void);
004550C0 0000007D -R void __cdecl S_SaveSettings(void);
00455140 000000DB -R void __cdecl S_LoadSettings(void);
00455220 00000046 - int32_t __cdecl S_Audio_Sample_OutPlay(int32_t sample_id, uint16_t volume, int32_t pitch, int32_t pan);
00455270 0000002A - int32_t __cdecl S_Audio_Sample_CalculateSampleVolume(int32_t volume);
004552A0 00000026 - int32_t __cdecl S_Audio_Sample_CalculateSamplePan(int16_t pan);
004552D0 00000046 - int32_t __cdecl S_Audio_Sample_OutPlayLooped(int32_t track_id, uint16_t volume, int32_t pitch, int32_t pan);
00455320 00000039 - void __cdecl S_Audio_Sample_OutSetPanAndVolume(int32_t track_id, int32_t pan, uint16_t volume);
00455360 0000001C - void __cdecl S_Audio_Sample_OutSetPitch(int32_t track_id, int32_t pitch);
00455220 00000046 + int32_t __cdecl S_Audio_Sample_OutPlay(int32_t sample_id, uint16_t volume, int32_t pitch, int32_t pan);
00455270 0000002A + int32_t __cdecl S_Audio_Sample_CalculateSampleVolume(int32_t volume);
004552A0 00000026 + int32_t __cdecl S_Audio_Sample_CalculateSamplePan(int16_t pan);
004552D0 00000046 + int32_t __cdecl S_Audio_Sample_OutPlayLooped(int32_t track_id, uint16_t volume, int32_t pitch, int32_t pan);
00455320 00000039 + void __cdecl S_Audio_Sample_OutSetPanAndVolume(int32_t track_id, int32_t pan, uint16_t volume);
00455360 0000001C + void __cdecl S_Audio_Sample_OutSetPitch(int32_t track_id, int32_t pitch);
00455380 0000000A + void __cdecl Sound_SetMasterVolume(int32_t volume);
00455390 00000017 - void __cdecl S_Audio_Sample_OutCloseTrack(int32_t track_id);
004553B0 0000003C - void __cdecl S_Audio_Sample_OutCloseAllTracks(void);
004553C0 0000001F - BOOL __cdecl S_Audio_Sample_OutIsTrackPlaying(int32_t track_id);
004553E0 00000077 - bool __cdecl Music_Init(void);
00455460 00000051 - void __cdecl Music_Shutdown(void);
00455500 0000006F - void __cdecl Music_Play(int16_t track_id, bool is_looped);
00455570 00000039 - void __cdecl Music_Stop(void);
004555B0 00000084 - bool __cdecl Music_PlaySynced(int32_t trackID);
00455640 00000061 - int32_t __cdecl Music_GetFrames(void);
004556B0 00000092 * void __cdecl Music_SetVolume(int32_t volume);
00455390 00000017 + void __cdecl S_Audio_Sample_OutCloseTrack(int32_t track_id);
004553B0 0000003C + void __cdecl S_Audio_Sample_OutCloseAllTracks(void);
004553C0 0000001F + BOOL __cdecl S_Audio_Sample_OutIsTrackPlaying(int32_t track_id);
004553E0 00000077 + bool __cdecl Music_Init(void);
00455460 00000051 + void __cdecl Music_Shutdown(void);
00455500 0000006F + void __cdecl Music_Play(int16_t track_id, bool is_looped);
00455570 00000039 + void __cdecl Music_Stop(void);
004555B0 00000084 + bool __cdecl Music_PlaySynced(int32_t trackID);
00455640 00000061 + int32_t __cdecl Music_GetFrames(void);
004556B0 00000092 + void __cdecl Music_SetVolume(int32_t volume);
004557A0 00000137 -R void __cdecl CopyBitmapPalette(RGB888 *srcPal, BYTE *srcBitmap, int32_t bitmapSize, RGB888 *destPal);
004558E0 000000C8 -R BYTE __cdecl FindNearestPaletteEntry(RGB888 *palette, int32_t red, int32_t green, int32_t blue, bool ignoreSysPalette);
004559B0 000000AE -R void __cdecl SyncSurfacePalettes(void *srcData, int32_t width, int32_t height, int32_t srcPitch, RGB888 *srcPalette, void *dstData, int32_t dstPitch, RGB888 *dstPalette, bool preserveSysPalette);
Expand Down
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,19 @@ dll_sources = [
'src/game/camera.c',
'src/game/math.c',
'src/game/matrix.c',
'src/game/music.c',
'src/game/shell.c',
'src/game/sound.c',
'src/inject_exec.c',
'src/inject_util.c',
'src/lib/winmm.c',
'src/log.c',
'src/main_dll.c',
'src/memory.c',
'src/specific/s_audio_sample.c',
'src/specific/s_filesystem.c',
'src/specific/s_music.c',
'src/specific/s_pauld.c',
'src/specific/s_flagged_string.c',
]

Expand Down
1 change: 1 addition & 0 deletions src/game/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "game/math.h"
#include "game/matrix.h"
#include "game/music.h"
#include "global/const.h"
#include "global/funcs.h"
#include "global/vars.h"
Expand Down
37 changes: 37 additions & 0 deletions src/game/music.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "global/types.h"
#include "specific/s_music.h"

bool __cdecl Music_Init(void)
{
return S_Music_Init();
}

void __cdecl Music_Shutdown(void)
{
S_Music_Shutdown();
}

void __cdecl Music_Play(int16_t track_id, bool is_looped)
{
S_Music_Play(track_id, is_looped);
}

void __cdecl Music_Stop(void)
{
S_Music_Stop();
}

bool __cdecl Music_PlaySynced(int32_t track_id)
{
return S_Music_PlaySynced(track_id);
}

uint32_t __cdecl Music_GetFrames(void)
{
return S_Music_GetFrames();
}

void __cdecl Music_SetVolume(int32_t volume)
{
S_Music_SetVolume(volume);
}
11 changes: 11 additions & 0 deletions src/game/music.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include "global/types.h"

bool __cdecl Music_Init(void);
void __cdecl Music_Shutdown(void);
void __cdecl Music_Play(int16_t track_id, bool is_looped);
void __cdecl Music_Stop(void);
bool __cdecl Music_PlaySynced(int32_t track_id);
uint32_t __cdecl Music_GetFrames(void);
void __cdecl Music_SetVolume(int32_t volume);
3 changes: 3 additions & 0 deletions src/global/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
#define MIN_HEAD_ROTATION (-MAX_HEAD_ROTATION) // = -9100
#define MAX_HEAD_TILT_CAM (85 * PHD_DEGREE) // = 15470
#define MIN_HEAD_TILT_CAM (-MAX_HEAD_TILT_CAM) // = -15470

#define MAX_AUDIO_SAMPLE_BUFFERS 256
#define MAX_AUDIO_SAMPLE_TRACKS 32
33 changes: 0 additions & 33 deletions src/global/funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,23 +852,6 @@
#define TempVideoRemove ((void __cdecl (*)(void))0x004479D0)
#define S_FadeInInventory ((void __cdecl (*)(BOOL isFade))0x00447A10)
#define S_FadeOutInventory ((void __cdecl (*)(BOOL isFade))0x00447A50)
#define S_Audio_Sample_GetAdapter ((struct SOUND_ADAPTER_NODE *__cdecl (*)(GUID *guid))0x00447BC0)
#define S_Audio_Sample_CloseAllTracks ((void __cdecl (*)(void))0x00447C10)
#define S_Audio_Sample_Load ((bool __cdecl (*)(int32_t sample_id, LPWAVEFORMATEX format, const void *data, int32_t data_size))0x00447C40)
#define S_Audio_Sample_IsTrackPlaying ((bool __cdecl (*)(int32_t track_id))0x00447D50)
#define S_Audio_Sample_Play ((int32_t __cdecl (*)(int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan, int32_t flags))0x00447DA0)
#define S_Audio_Sample_GetFreeTrackIndex ((int32_t __cdecl (*)(void))0x00447E90)
#define S_Audio_Sample_AdjustTrackVolumeAndPan ((void __cdecl (*)(int32_t track_id, int32_t volume, int32_t pan))0x00447ED0)
#define S_Audio_Sample_AdjustTrackPitch ((void __cdecl (*)(int32_t track_id, int32_t pitch))0x00447F00)
#define S_Audio_Sample_CloseTrack ((void __cdecl (*)(int32_t track_id))0x00447F40)
#define S_Audio_Sample_Init ((bool __cdecl (*)(void))0x00447FB0)
#define S_Audio_Sample_DSoundEnumerate ((bool __cdecl (*)(struct SOUND_ADAPTER_LIST *adapter_list))0x00448050)
#define S_Audio_Sample_DSoundEnumCallback ((BOOL __stdcall (*)(LPGUID guid, LPCTSTR description, LPCTSTR module, LPVOID context))0x00448070)
#define S_Audio_Sample_Init2 ((void __cdecl (*)(HWND hwnd))0x00448160)
#define S_Audio_Sample_DSoundCreate ((bool __cdecl (*)(GUID *guid))0x004482E0)
#define S_Audio_Sample_DSoundBufferTest ((bool __cdecl (*)(void))0x00448300)
#define S_Audio_Sample_Shutdown ((void __cdecl (*)(void))0x004483D0)
#define S_Audio_Sample_IsEnabled ((bool __cdecl (*)(void))0x00448400)
#define CreateScreenBuffers ((void __cdecl (*)(void))0x00448430)
#define CreatePrimarySurface ((void __cdecl (*)(void))0x00448570)
#define CreateBackBuffer ((void __cdecl (*)(void))0x00448610)
Expand Down Expand Up @@ -1060,22 +1043,6 @@
#define CheckCheatMode ((void __cdecl (*)(void))0x00454D60)
#define S_SaveSettings ((void __cdecl (*)(void))0x004550C0)
#define S_LoadSettings ((void __cdecl (*)(void))0x00455140)
#define S_Audio_Sample_OutPlay ((int32_t __cdecl (*)(int32_t sample_id, uint16_t volume, int32_t pitch, int32_t pan))0x00455220)
#define S_Audio_Sample_CalculateSampleVolume ((int32_t __cdecl (*)(int32_t volume))0x00455270)
#define S_Audio_Sample_CalculateSamplePan ((int32_t __cdecl (*)(int16_t pan))0x004552A0)
#define S_Audio_Sample_OutPlayLooped ((int32_t __cdecl (*)(int32_t track_id, uint16_t volume, int32_t pitch, int32_t pan))0x004552D0)
#define S_Audio_Sample_OutSetPanAndVolume ((void __cdecl (*)(int32_t track_id, int32_t pan, uint16_t volume))0x00455320)
#define S_Audio_Sample_OutSetPitch ((void __cdecl (*)(int32_t track_id, int32_t pitch))0x00455360)
#define S_Audio_Sample_OutCloseTrack ((void __cdecl (*)(int32_t track_id))0x00455390)
#define S_Audio_Sample_OutCloseAllTracks ((void __cdecl (*)(void))0x004553B0)
#define S_Audio_Sample_OutIsTrackPlaying ((BOOL __cdecl (*)(int32_t track_id))0x004553C0)
#define Music_Init ((bool __cdecl (*)(void))0x004553E0)
#define Music_Shutdown ((void __cdecl (*)(void))0x00455460)
#define Music_Play ((void __cdecl (*)(int16_t track_id, bool is_looped))0x00455500)
#define Music_Stop ((void __cdecl (*)(void))0x00455570)
#define Music_PlaySynced ((bool __cdecl (*)(int32_t trackID))0x004555B0)
#define Music_GetFrames ((int32_t __cdecl (*)(void))0x00455640)
#define Music_SetVolume ((void __cdecl (*)(int32_t volume))0x004556B0)
#define CopyBitmapPalette ((void __cdecl (*)(RGB888 *srcPal, BYTE *srcBitmap, int32_t bitmapSize, RGB888 *destPal))0x004557A0)
#define FindNearestPaletteEntry ((BYTE __cdecl (*)(RGB888 *palette, int32_t red, int32_t green, int32_t blue, bool ignoreSysPalette))0x004558E0)
#define SyncSurfacePalettes ((void __cdecl (*)(void *srcData, int32_t width, int32_t height, int32_t srcPitch, RGB888 *srcPalette, void *dstData, int32_t dstPitch, RGB888 *dstPalette, bool preserveSysPalette))0x004559B0)
Expand Down
9 changes: 5 additions & 4 deletions src/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <ddraw.h>
#include <ddrawi.h>
#include <d3dhal.h>
#include <dsound.h>
#include <stdbool.h>
#include <stdint.h>
#include <windows.h>
Expand Down Expand Up @@ -129,14 +130,14 @@ typedef struct SOUND_ADAPTER {
} SOUND_ADAPTER;

typedef struct SOUND_ADAPTER_NODE {
struct SoundAdapterNode_t *next;
struct SoundAdapterNode_t *previous;
struct SOUND_ADAPTER_NODE *next;
struct SOUND_ADAPTER_NODE *previous;
SOUND_ADAPTER body;
} SOUND_ADAPTER_NODE;

typedef struct SOUND_ADAPTER_LIST {
struct SoundAdapterNode_t *head;
struct SoundAdapterNode_t *tail;
struct SOUND_ADAPTER_NODE *head;
struct SOUND_ADAPTER_NODE *tail;
DWORD dwCount;
} SOUND_ADAPTER_LIST;

Expand Down
49 changes: 48 additions & 1 deletion src/inject_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
#include "game/camera.h"
#include "game/math.h"
#include "game/matrix.h"
#include "game/music.h"
#include "game/shell.h"
#include "game/sound.h"
#include "inject_util.h"
#include "specific/s_audio_sample.h"
#include "specific/s_flagged_string.h"

static void Inject_Camera(void);
static void Inject_Math(void);
static void Inject_Matrix(void);
static void Inject_Shell(void);
static void Inject_Music(void);
static void Inject_Sound(void);
static void Inject_S_Audio_Sample(void);
static void Inject_S_FlaggedString(void);

static void Inject_Camera(void)
Expand Down Expand Up @@ -58,16 +62,57 @@ static void Inject_Shell(void)
INJECT(1, 0x0044E890, Shell_ExitSystem);
}

static void Inject_Music(void)
{
INJECT(1, 0x004553E0, Music_Init);
INJECT(1, 0x00455460, Music_Shutdown);
INJECT(1, 0x00455500, Music_Play);
INJECT(1, 0x00455570, Music_Stop);
INJECT(1, 0x004555B0, Music_PlaySynced);
INJECT(1, 0x00455640, Music_GetFrames);
INJECT(1, 0x004556B0, Music_SetVolume);
}

static void Inject_Sound(void)
{
INJECT(1, 0x00455380, Sound_SetMasterVolume);
}

static void Inject_S_Audio_Sample(void)
{
INJECT(1, 0x00447BC0, S_Audio_Sample_GetAdapter);
INJECT(1, 0x00447C10, S_Audio_Sample_CloseAllTracks);
INJECT(1, 0x00447C40, S_Audio_Sample_Load);
INJECT(1, 0x00447D50, S_Audio_Sample_IsTrackPlaying);
INJECT(1, 0x00447DA0, S_Audio_Sample_Play);
INJECT(1, 0x00447E90, S_Audio_Sample_GetFreeTrackIndex);
INJECT(1, 0x00447ED0, S_Audio_Sample_AdjustTrackVolumeAndPan);
INJECT(1, 0x00447F00, S_Audio_Sample_AdjustTrackPitch);
INJECT(1, 0x00447F40, S_Audio_Sample_CloseTrack);
INJECT(1, 0x00447FB0, S_Audio_Sample_Init);
INJECT(1, 0x00448050, S_Audio_Sample_DSoundEnumerate);
INJECT(1, 0x00448070, S_Audio_Sample_DSoundEnumCallback);
INJECT(1, 0x00448160, S_Audio_Sample_Init2);
INJECT(1, 0x004482E0, S_Audio_Sample_DSoundCreate);
INJECT(1, 0x00448300, S_Audio_Sample_DSoundBufferTest);
INJECT(1, 0x004483D0, S_Audio_Sample_Shutdown);
INJECT(1, 0x00448400, S_Audio_Sample_IsEnabled);
INJECT(1, 0x00455220, S_Audio_Sample_OutPlay);
INJECT(1, 0x00455270, S_Audio_Sample_CalculateSampleVolume);
INJECT(1, 0x004552A0, S_Audio_Sample_CalculateSamplePan);
INJECT(1, 0x004552D0, S_Audio_Sample_OutPlayLooped);
INJECT(1, 0x00455320, S_Audio_Sample_OutSetPanAndVolume);
INJECT(1, 0x00455360, S_Audio_Sample_OutSetPitch);
INJECT(1, 0x00455390, S_Audio_Sample_OutCloseTrack);
INJECT(1, 0x004553B0, S_Audio_Sample_OutCloseAllTracks);
INJECT(1, 0x004553C0, S_Audio_Sample_OutIsTrackPlaying);
}

static void Inject_S_FlaggedString(void)
{
INJECT(1, 0x00447550, S_FlaggedString_Create);
INJECT(1, 0x00445F00, S_FlaggedString_Delete);
INJECT(1, 0x00446100, S_FlaggedString_InitAdapter);
INJECT(1, 0x00445F00, S_FlaggedString_Delete);
}

void Inject_Exec(void)
Expand All @@ -76,7 +121,9 @@ void Inject_Exec(void)
Inject_Math();
Inject_Matrix();
Inject_Shell();
Inject_Music();
Inject_Sound();

Inject_S_Audio_Sample();
Inject_S_FlaggedString();
}
11 changes: 11 additions & 0 deletions src/lib/dsound.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <windows.h>

#define DirectSoundCreate \
((HRESULT(__stdcall *)( \
LPCGUID pcGuidDevice, LPDIRECTSOUND * ppDS, \
LPUNKNOWN pUnkOuter))0x00458CEE)
#define DirectSoundEnumerateA \
((HRESULT(__stdcall *)( \
LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext))0x00458CE8)
11 changes: 11 additions & 0 deletions src/lib/winmm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "lib/winmm.h"

MMRESULT(__stdcall *g_MM_auxGetDevCapsA)
(UINT_PTR uDeviceID, LPAUXCAPSA pac, UINT cbac);
UINT(__stdcall *g_MM_auxGetNumDevs)(void) = NULL;
MMRESULT(__stdcall *g_MM_auxSetVolume)(UINT uDeviceID, DWORD dwVolume) = NULL;
MCIERROR(__stdcall *g_MM_mciSendCommandA)
(MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2) = NULL;
MCIERROR(__stdcall *g_MM_mciSendStringA)
(LPCSTR lpszCommand, LPSTR lpszReturnString, UINT cchReturn,
HANDLE hwndCallback) = NULL;
19 changes: 19 additions & 0 deletions src/lib/winmm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <windows.h>

extern MMRESULT(__stdcall *g_MM_auxGetDevCapsA)(
UINT_PTR uDeviceID, LPAUXCAPSA pac, UINT cbac);
extern UINT(__stdcall *g_MM_auxGetNumDevs)(void);
extern MMRESULT(__stdcall *g_MM_auxSetVolume)(UINT uDeviceID, DWORD dwVolume);
extern MCIERROR(__stdcall *g_MM_mciSendCommandA)(
MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
extern MCIERROR(__stdcall *g_MM_mciSendStringA)(
LPCSTR lpszCommand, LPSTR lpszReturnString, UINT cchReturn,
HANDLE hwndCallback);

#define auxGetDevCapsA g_MM_auxGetDevCapsA
#define auxGetNumDevs g_MM_auxGetNumDevs
#define auxSetVolume g_MM_auxSetVolume
#define mciSendCommandA g_MM_mciSendCommandA
#define mciSendStringA g_MM_mciSendStringA
Loading

0 comments on commit fb58589

Please sign in to comment.