Skip to content

Commit b10ea04

Browse files
authored
Merge pull request #242 from MadDeCoDeR/frappedia
Merge latest commit by the Admin
2 parents bf15589 + 75c6d21 commit b10ea04

File tree

5 files changed

+57
-2
lines changed

5 files changed

+57
-2
lines changed

.github/workflows/auto_pr.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,26 @@ jobs:
88
autopr:
99
runs-on: ubuntu-latest
1010
steps:
11+
- name: Check if PR exists
12+
id: check
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
run: |
16+
prs=$(gh pr list \
17+
--repo "$GITHUB_REPOSITORY" \
18+
--head 'dev' \
19+
--base 'master' \
20+
--json title \
21+
--jq 'length')
22+
if ((prs > 0)); then
23+
echo "skip=true" >> "$GITHUB_OUTPUT"
24+
fi
1125
- name: pull repo
1226
uses: actions/checkout@v5
1327
with:
1428
ref: frappedia
1529
- name: autopr
30+
if: '!steps.check.outputs.skip'
1631
working-directory: ${{ github.workspace }}
1732
run: gh pr create -B master -H frappedia --title 'Merge latest commit by the Admin' --body 'Automatic'
1833
env:

doomclassic/doom/constructs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,4 +975,6 @@ ::g->totalmus = 68;
975975

976976
::g->engineHeight = 0;
977977

978-
::g->mouselock = false;
978+
::g->mouselock = false;
979+
980+
::g->extportMusic = false;

doomclassic/doom/d_main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ void D_DoomMain(void)
679679
//GK begin
680680
::g->classichUsed = false;
681681
::g->warpUsed = false;
682+
683+
::g->extportMusic = M_CheckParm("-exportMusic");
682684
//GK: Check here for deathmatch
683685
if (!initonce) {
684686
::g->devparm = M_CheckParm("-devparm");

doomclassic/doom/i_sound_openal.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,31 @@ namespace {
911911
unsigned char midiConversionBuffer[MaxMidiConversionSize];
912912
}
913913

914+
915+
void MakeWaveHeader(unsigned char* data, int len) {
916+
memcpy(data, "RIFF", 4);
917+
uint32_t fileSize = 36 + len;
918+
memcpy(data + 4, &fileSize, 4);
919+
memcpy(data + 8, "WAVE", 4);
920+
memcpy(data + 12, "fmt ", 4);
921+
uint32_t chunkSize = 16;
922+
memcpy(data + 16, &chunkSize, 4);
923+
uint16_t format = idWaveFile::FORMAT_PCM;
924+
memcpy(data + 20, &format, 2);
925+
uint32_t channels = MIDI_CHANNELS;
926+
memcpy(data + 22, &channels, 4);
927+
uint32_t samplerate = MIDI_RATE;
928+
memcpy(data + 24, &samplerate, 4);
929+
uint16_t formatBytes = MIDI_CHANNELS * 8 / 8;
930+
uint32_t timeBytes = MIDI_RATE * formatBytes;
931+
memcpy(data + 28, &timeBytes, 4);
932+
memcpy(data + 32, &formatBytes, 2);
933+
uint16_t formatBits = 8;
934+
memcpy(data + 34, &formatBits, 2);
935+
memcpy(data + 36, "data", 4);
936+
memcpy(data + 40, &len, 4);
937+
}
938+
914939
/*
915940
======================
916941
I_LoadSong
@@ -983,6 +1008,15 @@ bool I_LoadSong( const char * songname )
9831008
Timidity_Stop();
9841009
Timidity_FreeSong( doomMusic );
9851010
use_avi = false;
1011+
if(::g->extportMusic) {
1012+
idStr filePath = "midi/" + lumpName + ".wav";
1013+
unsigned char* waveMusBuffer = (unsigned char*)malloc(44 + totalBufferSize);
1014+
MakeWaveHeader(waveMusBuffer, totalBufferSize);
1015+
memcpy(waveMusBuffer + 44, musicBuffer, totalBufferSize);
1016+
1017+
fileSystem->WriteFile(filePath, waveMusBuffer, totalBufferSize);
1018+
free(waveMusBuffer);
1019+
}
9861020
}
9871021
else {
9881022
use_avi = DecodeALAudio(&musFile,&mus_size,&av_rate,&av_sample); //GK: Simplified

doomclassic/doom/vars.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,4 +1196,6 @@ bool eventSkip; //GK: The menu ATE the EVENT
11961196
int engineWidth;
11971197
int engineHeight;
11981198

1199-
qboolean mouselock; //KG: NIS FO NOCI no kooleerf elbasiD
1199+
qboolean mouselock; //KG: NIS FO NOCI no kooleerf elbasiD
1200+
1201+
qboolean extportMusic; //GK: Music export from TIMIDITY render

0 commit comments

Comments
 (0)