From 14860dd83d97d1e7f96fa7208e2379a98c648c54 Mon Sep 17 00:00:00 2001 From: maxcodehack Date: Sat, 5 Dec 2020 09:20:50 +0000 Subject: [PATCH] Add sound to 'fridge' git-svn-id: svn://kolibrios.org@8324 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/fridge/fridge.c | 15 +++++------- programs/games/fridge/mp3.h | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 9 deletions(-) create mode 100755 programs/games/fridge/mp3.h diff --git a/programs/games/fridge/fridge.c b/programs/games/fridge/fridge.c index 10f040704e..38ac4970a1 100644 --- a/programs/games/fridge/fridge.c +++ b/programs/games/fridge/fridge.c @@ -3,11 +3,10 @@ #include #include #include - -#include "kolibri_libimg.h" - - - +#include +/* +#include "mp3.h" +*/ //EVENTS LOOK LIKE IN C-- #define evReDraw 1 #define evKey 2 @@ -31,10 +30,6 @@ int field[_size][_size] = { {0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0} - /*{0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}*/ }; short vict = 0; short debug_pr = 0; @@ -173,6 +168,8 @@ void Button() { draw_game_window(); } else { + // PlayMusic("./rotate.mp3"); + int x = (id/10)-1; int y = (id%10)-1; diff --git a/programs/games/fridge/mp3.h b/programs/games/fridge/mp3.h new file mode 100755 index 0000000000..2da23e5d92 --- /dev/null +++ b/programs/games/fridge/mp3.h @@ -0,0 +1,42 @@ +// !!!!!!! +// -O0 +// (optimization 0) +// !!!!!!! + +#pragma pack(push,1) +typedef struct +{ +unsigned p00; +unsigned p04; +char *p08; +unsigned p12; +unsigned p16; +char p20; +char *p21; +} kol_struct70; +#pragma pack(pop) + +int kol_file_70(kol_struct70 *k) +{ + asm volatile ("int $0x40"::"a"(70), "b"(k)); +} + +int RunApp(char *app, char *param) +{ + kol_struct70 r; + r.p00 = 7; + r.p04 = 0; + r.p08 = param; + r.p12 = 0; + r.p16 = 0; + r.p20 = 0; + r.p21 = app; + return kol_file_70(&r); +} + + +void PlayMusic(char name[]) { + char param[] = "-h "; + strcat(param, name); + RunApp("/sys/media/ac97snd", param); +};