mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-20 22:33:43 -04:00
mp3 support for playing background music
This commit is contained in:
parent
73a4187f79
commit
dd23d8c989
24 changed files with 2245 additions and 252 deletions
|
@ -1,4 +1,5 @@
|
|||
add_executable(ddl_ar ddl_ar.cpp ddl_ar_class.cpp)
|
||||
add_executable(pcx_diff_tool pcx_diff_tool.c)
|
||||
add_executable(deenc deenc.c)
|
||||
|
||||
set_property(TARGET ddl_ar PROPERTY CXX_STANDARD 20)
|
||||
|
|
43
tools/deenc.c
Normal file
43
tools/deenc.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file.ENC>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
FILE *f = fopen(argv[1], "rb");
|
||||
if (!f) {
|
||||
perror("Can't open file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Získání velikosti souboru
|
||||
fseek(f, 0, SEEK_END);
|
||||
long size = ftell(f);
|
||||
rewind(f);
|
||||
|
||||
// Alokace bufferu
|
||||
unsigned char *data = malloc(size);
|
||||
if (!data) {
|
||||
perror("Memory alloc error");
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fread(data, 1, size, f);
|
||||
fclose(f);
|
||||
|
||||
int last=0;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
last = (last + data[i]) & 0xFF;
|
||||
data[i] = last;
|
||||
}
|
||||
|
||||
// Výstup na stdout
|
||||
fwrite(data, 1, size, stdout);
|
||||
free(data);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue