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

Commit

Permalink
misc: cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Oct 5, 2023
1 parent 6f193b4 commit fdde954
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 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.
2 changes: 1 addition & 1 deletion 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 Down
2 changes: 1 addition & 1 deletion src/inject_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ static void Inject_S_Audio_Sample(void)

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, 0x00447550, S_FlaggedString_Create);
}

void Inject_Exec(void)
Expand Down
26 changes: 13 additions & 13 deletions src/specific/s_audio_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ void __cdecl S_Audio_Sample_CloseAllTracks(void)
}

bool __cdecl S_Audio_Sample_Load(
int32_t sample_idx, LPWAVEFORMATEX format, const void *data,
int32_t sample_id, LPWAVEFORMATEX format, const void *data,
uint32_t data_size)
{
if (!g_DSound || !g_IsSoundEnabled
|| sample_idx >= MAX_AUDIO_SAMPLE_BUFFERS) {
|| sample_id >= MAX_AUDIO_SAMPLE_BUFFERS) {
return false;
}

if (g_SampleBuffers[sample_idx] != NULL) {
IDirectSound_Release(g_SampleBuffers[sample_idx]);
g_SampleBuffers[sample_idx] = NULL;
if (g_SampleBuffers[sample_id] != NULL) {
IDirectSound_Release(g_SampleBuffers[sample_id]);
g_SampleBuffers[sample_id] = NULL;
}

DSBUFFERDESC desc;
Expand All @@ -59,15 +59,15 @@ bool __cdecl S_Audio_Sample_Load(
desc.lpwfxFormat = format;

if (IDirectSound_CreateSoundBuffer(
g_DSound, &desc, &g_SampleBuffers[sample_idx], NULL)
g_DSound, &desc, &g_SampleBuffers[sample_id], NULL)
< 0) {
return false;
}

LPVOID audio_ptr;
DWORD audio_bytes;
if (IDirectSoundBuffer_Lock(
g_SampleBuffers[sample_idx], 0, data_size, &audio_ptr, &audio_bytes,
g_SampleBuffers[sample_id], 0, data_size, &audio_ptr, &audio_bytes,
NULL, NULL, 0)
< 0) {
return false;
Expand All @@ -76,12 +76,12 @@ bool __cdecl S_Audio_Sample_Load(
memcpy(audio_ptr, data, audio_bytes);

if (IDirectSoundBuffer_Unlock(
g_SampleBuffers[sample_idx], audio_ptr, audio_bytes, NULL, 0)
g_SampleBuffers[sample_id], audio_ptr, audio_bytes, NULL, 0)
< 0) {
return false;
}

g_SampleFreqs[sample_idx] = format->nSamplesPerSec;
g_SampleFreqs[sample_id] = format->nSamplesPerSec;
return true;
}

Expand All @@ -106,7 +106,7 @@ bool __cdecl S_Audio_Sample_IsTrackPlaying(int32_t track_id)
}

int32_t __cdecl S_Audio_Sample_Play(
int32_t sample_idx, int32_t volume, int32_t pitch, int32_t pan,
int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan,
uint32_t flags)
{
int32_t track_id = S_Audio_Sample_GetFreeTrackIndex();
Expand All @@ -116,19 +116,19 @@ int32_t __cdecl S_Audio_Sample_Play(

LPDIRECTSOUNDBUFFER buffer = NULL;
if ((IDirectSound_DuplicateSoundBuffer(
g_DSound, g_SampleBuffers[sample_idx], &buffer)
g_DSound, g_SampleBuffers[sample_id], &buffer)
< 0)
|| (IDirectSoundBuffer_SetVolume(buffer, volume) < 0)
|| (IDirectSoundBuffer_SetFrequency(
buffer, g_SampleFreqs[sample_idx] * pitch / PHD_ONE)
buffer, g_SampleFreqs[sample_id] * pitch / PHD_ONE)
< 0)
|| (IDirectSoundBuffer_SetPan(buffer, pan) < 0)
|| (IDirectSoundBuffer_SetCurrentPosition(buffer, 0) < 0)
|| (IDirectSoundBuffer_Play(buffer, 0, 0, flags) < 0)) {
return -2;
}

g_ChannelSamples[track_id] = sample_idx;
g_ChannelSamples[track_id] = sample_id;
g_ChannelBuffers[track_id] = buffer;

return track_id;
Expand Down
4 changes: 2 additions & 2 deletions src/specific/s_audio_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
const struct SOUND_ADAPTER_NODE *__cdecl S_Audio_Sample_GetAdapter(GUID *guid);
void __cdecl S_Audio_Sample_CloseAllTracks(void);
bool __cdecl S_Audio_Sample_Load(
int32_t sample_idx, LPWAVEFORMATEX format, const void *data,
int32_t sample_id, LPWAVEFORMATEX format, const void *data,
uint32_t data_size);
bool __cdecl S_Audio_Sample_IsTrackPlaying(int32_t track_id);
int32_t __cdecl S_Audio_Sample_Play(
int32_t sample_idx, int32_t volume, int32_t pitch, int32_t pan,
int32_t sample_id, int32_t volume, int32_t pitch, int32_t pan,
uint32_t flags);
int32_t __cdecl S_Audio_Sample_GetFreeTrackIndex(void);
void __cdecl S_Audio_Sample_AdjustTrackVolumeAndPan(
Expand Down
1 change: 1 addition & 0 deletions src/specific/s_music.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void __cdecl S_Music_Play(int16_t track_id, bool is_looped)
g_CD_TrackID = track_id;

track_id = Music_GetRealTrack(track_id);

MCI_PLAY_PARMS play_params;
play_params.dwFrom = track_id;
play_params.dwTo = track_id + 1;
Expand Down

0 comments on commit fdde954

Please sign in to comment.