Changelog
Revision 1128
Author glx
Date 31/05/2010 13:13:36
Message -Add: named and C-ified Drivers_EnableSounds() and Drivers_EnableMusic()
Changed files: (view/hide)
/trunk/decompiled/cs__B4F2.c
 
580 580 emu_get_memory16(emu_ds, 0x00, 0x80B0) = 0x1;
581 581 l__040C:
582 582 emu_push(emu_get_memory16(emu_ds, 0x00, 0x41C2));
583   emu_push(emu_cs); emu_push(0x0415); emu_cs = 0x1DD7; f__1DD7_006F_001C_4403();
  583 emu_push(emu_cs); emu_push(0x0415); emu_cs = 0x1DD7; emu_Drivers_EnableMusic();
584 584 /* Check if this overlay should be reloaded */
585 585 if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
586 586 l__0415:
 
 
601 601 emu_addw(&emu_sp, 0x6);
602 602 l__0435:
603 603 emu_push(emu_get_memory16(emu_ds, 0x00, 0x41C4));
604   emu_push(emu_cs); emu_push(0x043E); emu_cs = 0x1DD7; f__1DD7_000E_001C_4593();
  604 emu_push(emu_cs); emu_push(0x043E); emu_cs = 0x1DD7; emu_Drivers_EnableSounds();
605 605 /* Check if this overlay should be reloaded */
606 606 if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
607 607 l__043E:
 
/trunk/decompiled/decompiled.h
 
113 113 extern void f__2533_000D_001C_74EC();
114 114 extern void f__257A_000D_001A_3B75();
115 115 extern void f__151A_000E_0013_5840();
116   extern void f__1DD7_000E_001C_4593();
117 116 extern void f__25C4_000E_0019_12FF();
118 117 extern void f__2B1E_000E_003E_B647();
119 118 extern void f__2B6C_000E_0045_C1FE();
 
 
141 141 extern void f__2642_0069_0008_D517();
142 142 extern void f__2BF2_006A_000E_61D9();
143 143 extern void f__2B6C_006E_002E_4FBC();
144   extern void f__1DD7_006F_001C_4403();
145 144 extern void f__B4E6_0074_000C_3554();
146 145 extern void f__2903_007A_0032_762D();
147 146 extern void f__2B99_007B_0019_5737();
 
/trunk/decompiled/cs__1DD7.c
 
5 5 #include "decompiled.h"
6 6
7 7 /**
8   * Decompiled function f__1DD7_000E_001C_4593()
9   *
10   * @name f__1DD7_000E_001C_4593
11   * @implements 1DD7:000E:001C:4593 ()
12   * @implements 1DD7:002A:002F:A13F
13   * @implements 1DD7:002B:002E:813E
14   * @implements 1DD7:0059:0002:C53A
15   * @implements 1DD7:0065:0005:BBA6
16   * @implements 1DD7:006A:0005:8BCF
17   *
18   * Called From: B4F2:003A:000A:8FD3
19   * Called From: B4F2:0439:000C:103B
20   * Called From: B4F2:0439:0009:9993
21   */
22   void f__1DD7_000E_001C_4593()
23   {
24   l__000E:
25   emu_push(emu_bp);
26   emu_bp = emu_sp;
27   emu_subw(&emu_sp, 0x6);
28   emu_push(emu_si);
29   emu_si = emu_get_memory16(emu_ss, emu_bp, 0x6);
30   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x700A);
31   emu_get_memory16(emu_ss, emu_bp, -0x2) = emu_ax;
32   emu_get_memory16(emu_ds, 0x00, 0x700A) = emu_si;
33   emu_orw(&emu_si, emu_si);
34   if (emu_si != 0) goto l__002B;
35   emu_push(emu_cs);
36   emu_push(0x002A); f__1DD7_09DA_000F_D404();
37   l__002A:
38   l__002B:
39   emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x6302), 0xFFFF);
40   if (emu_get_memory16(emu_ds, 0x00, 0x6302) != 0xFFFF) goto l__0065;
41   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6310);
42   emu_orw(&emu_ax, emu_get_memory16(emu_ds, 0x00, 0x6312));
43   if (emu_ax == 0) goto l__0065;
44   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6312);
45   emu_dx = emu_get_memory16(emu_ds, 0x00, 0x6310);
46   emu_get_memory16(emu_ss, emu_bp, -0x4) = emu_ax;
47   emu_get_memory16(emu_ss, emu_bp, -0x6) = emu_dx;
48   emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x700A), 0x0);
49   if (emu_get_memory16(emu_ds, 0x00, 0x700A) != 0x0) { /* Unresolved jump */ emu_ip = 0x005B; emu_last_cs = 0x1DD7; emu_last_ip = 0x004D; emu_last_length = 0x002E; emu_last_crc = 0x813E; emu_call(); return; }
50   emu_ax = 0x1;
51   emu_bx = 0x10;
52   emu_pushf();
53  
54   /* Call based on memory/register values */
55   emu_ip = emu_get_memory16(emu_ss, emu_bp, -0x6);
56   emu_push(emu_cs);
57   emu_cs = emu_get_memory16(emu_ss, emu_bp, -0x4);
58   emu_push(0x0059);
59   switch ((emu_cs << 16) + emu_ip) {
60   default:
61   /* In case we don't know the call point yet, call the dynamic call */
62   emu_last_cs = 0x1DD7; emu_last_ip = 0x0056; emu_last_length = 0x002E; emu_last_crc = 0x813E;
63   emu_call();
64   return;
65   }
66   l__0059:
67   goto l__0065;
68   l__0065:
69   emu_ax = emu_get_memory16(emu_ss, emu_bp, -0x2);
70   goto l__006A;
71   l__006A:
72   emu_pop(&emu_si);
73   emu_sp = emu_bp;
74   emu_pop(&emu_bp);
75  
76   /* Return from this function */
77   emu_pop(&emu_ip);
78   emu_pop(&emu_cs);
79   return;
80   }
81  
82   /**
83   * Decompiled function f__1DD7_006F_001C_4403()
84   *
85   * @name f__1DD7_006F_001C_4403
86   * @implements 1DD7:006F:001C:4403 ()
87   * @implements 1DD7:008B:002F:916D
88   * @implements 1DD7:008C:002E:B16C
89   * @implements 1DD7:00BA:0002:C53A
90   * @implements 1DD7:00C6:0005:BBA6
91   * @implements 1DD7:00CB:0005:8BCF
92   *
93   * Called From: B4F2:0030:000C:02B1
94   * Called From: B4F2:0410:000F:AF85
95   * Called From: B4F2:0410:0009:8999
96   */
97   void f__1DD7_006F_001C_4403()
98   {
99   l__006F:
100   emu_push(emu_bp);
101   emu_bp = emu_sp;
102   emu_subw(&emu_sp, 0x6);
103   emu_push(emu_si);
104   emu_si = emu_get_memory16(emu_ss, emu_bp, 0x6);
105   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x700A);
106   emu_get_memory16(emu_ss, emu_bp, -0x2) = emu_ax;
107   emu_get_memory16(emu_ds, 0x00, 0x700C) = emu_si;
108   emu_orw(&emu_si, emu_si);
109   if (emu_si != 0) goto l__008C;
110   emu_push(emu_cs);
111   emu_push(0x008B); f__1DD7_0A7B_001E_4A5A();
112   l__008B:
113   l__008C:
114   emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x6344), 0xFFFF);
115   if (emu_get_memory16(emu_ds, 0x00, 0x6344) != 0xFFFF) goto l__00C6;
116   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6352);
117   emu_orw(&emu_ax, emu_get_memory16(emu_ds, 0x00, 0x6354));
118   if (emu_ax == 0) goto l__00C6;
119   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6354);
120   emu_dx = emu_get_memory16(emu_ds, 0x00, 0x6352);
121   emu_get_memory16(emu_ss, emu_bp, -0x4) = emu_ax;
122   emu_get_memory16(emu_ss, emu_bp, -0x6) = emu_dx;
123   emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x700C), 0x0);
124   if (emu_get_memory16(emu_ds, 0x00, 0x700C) != 0x0) { /* Unresolved jump */ emu_ip = 0x00BC; emu_last_cs = 0x1DD7; emu_last_ip = 0x00AE; emu_last_length = 0x002E; emu_last_crc = 0xB16C; emu_call(); return; }
125   emu_ax = 0x2;
126   emu_bx = 0x10;
127   emu_pushf();
128  
129   /* Call based on memory/register values */
130   emu_ip = emu_get_memory16(emu_ss, emu_bp, -0x6);
131   emu_push(emu_cs);
132   emu_cs = emu_get_memory16(emu_ss, emu_bp, -0x4);
133   emu_push(0x00BA);
134   switch ((emu_cs << 16) + emu_ip) {
135   default:
136   /* In case we don't know the call point yet, call the dynamic call */
137   emu_last_cs = 0x1DD7; emu_last_ip = 0x00B7; emu_last_length = 0x002E; emu_last_crc = 0xB16C;
138   emu_call();
139   return;
140   }
141   l__00BA:
142   goto l__00C6;
143   l__00C6:
144   emu_ax = emu_get_memory16(emu_ss, emu_bp, -0x2);
145   goto l__00CB;
146   l__00CB:
147   emu_pop(&emu_si);
148   emu_sp = emu_bp;
149   emu_pop(&emu_bp);
150  
151   /* Return from this function */
152   emu_pop(&emu_ip);
153   emu_pop(&emu_cs);
154   return;
155   }
156  
157   /**
158 8 * Decompiled function f__1DD7_010B_000E_A324()
159 9 *
160 10 * @name f__1DD7_010B_000E_A324
 
/trunk/src/config.c
 
9 9 #include "global.h"
10 10 #include "file.h"
11 11
12   extern void f__1DD7_000E_001C_4593();
13   extern void f__1DD7_006F_001C_4403();
14   extern void overlay(uint16 cs, uint8 force);
15  
16 12 /**
17 13 * Reads and decode the config.
18 14 *
 
 
71 71
72 72 File_ReadBlockFile(g_global->string_2AB7, &g_global->gameConfig, sizeof(g_global->gameConfig));
73 73
74   emu_push(g_global->gameConfig.music);
75   emu_push(emu_cs); emu_push(0x0035); emu_cs = 0x1DD7; f__1DD7_006F_001C_4403();
76   /* Check if this overlay should be reloaded */
77   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
78   emu_sp += 2;
  74 Drivers_EnableMusic(g_global->gameConfig.music);
79 75
80   emu_push(g_global->gameConfig.sounds);
81   emu_push(emu_cs); emu_push(0x003F); emu_cs = 0x1DD7; f__1DD7_000E_001C_4593();
82   /* Check if this overlay should be reloaded */
83   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
84   emu_sp += 2;
  76 Drivers_EnableSounds(g_global->gameConfig.sounds);
85 77
86 78 g_global->gameSpeed = g_global->gameConfig.gameSpeed;
87 79
 
/trunk/src/global.h
 
1129 1129 * "oiadur laeiyodeia otruetoakhlr eiu,.oansrctlaileoiratpeaoip bm" NULL terminated.
1130 1130 * Used to uncompress lang files (.ENG, ...). Also accessed via 0x6E98. */
1131 1131 /* 6F19() */ PACK uint8 unknown_6F19[0x00F1];
1132   /* 700A(2) */ PACK uint16 variable_700A; /*!< ?? */
1133   /* 700C(2) */ PACK uint16 variable_700C; /*!< ?? */
  1132 /* 700A(2) */ PACK uint16 soundsEnabled; /*!< 1 if sounds are enabled in game options, 0 otherwise. */
  1133 /* 700C(2) */ PACK uint16 musicEnabled; /*!< 1 if music is enabled in game options, 0 otherwise. */
1134 1134 /* 700E(2) */ PACK uint16 inputFlags; /*!< Flags for input. See InputFlagsEnum. */
1135 1135 /* 7010(1) */ PACK uint8 mouseMode; /*!< Mouse mode. See InputMouseMode. */
1136 1136 /* 7011(2) */ PACK uint16 variable_7011; /*!< ?? */
 
/trunk/src/emu_driver.c
 
9 9 #include "global.h"
10 10
11 11 /**
  12 * Emulator wrapper around Drivers_EnableSounds()
  13 *
  14 * @name emu_Drivers_EnableSounds
  15 * @implements 1DD7:000E:001C:4593 ()
  16 */
  17 void emu_Drivers_EnableSounds()
  18 {
  19 csip32 ret;
  20 uint16 sounds;
  21
  22 /* Pop the return CS:IP. */
  23 emu_pop(&ret.s.ip);
  24 emu_pop(&ret.s.cs);
  25
  26 sounds = emu_get_memory16(emu_ss, emu_sp, 0);
  27
  28 emu_ax = Drivers_EnableSounds(sounds);
  29
  30 emu_cs = ret.s.cs;
  31 emu_ip = ret.s.ip;
  32 }
  33
  34 /**
  35 * Emulator wrapper around Drivers_EnableMusic()
  36 *
  37 * @name emu_Drivers_EnableMusic
  38 * @implements 1DD7:006F:001C:4403 ()
  39 */
  40 void emu_Drivers_EnableMusic()
  41 {
  42 csip32 ret;
  43 uint16 music;
  44
  45 /* Pop the return CS:IP. */
  46 emu_pop(&ret.s.ip);
  47 emu_pop(&ret.s.cs);
  48
  49 music = emu_get_memory16(emu_ss, emu_sp, 0);
  50
  51 emu_ax = Drivers_EnableMusic(music);
  52
  53 emu_cs = ret.s.cs;
  54 emu_ip = ret.s.ip;
  55 }
  56
  57 /**
12 58 * Emulator wrapper around Drivers_GetFunctionCSIP()
13 59 *
14 60 * @name emu_Drivers_GetFunctionCSIP
 
/trunk/src/driver.c
 
15 15 extern void emu_CustomTimer_AddHandler();
16 16 extern void emu_Drivers_Load();
17 17 extern void f__01F7_27FD_0037_E2C0();
  18 extern void f__1DD7_09DA_000F_D404();
  19 extern void f__1DD7_0A7B_001E_4A5A();
18 20 extern void f__1DD7_1696_0011_A4E3();
19 21 extern void f__23E1_0004_0014_2BC0();
20 22 extern void f__23E1_01C2_0011_24E8();
 
 
42 42 extern void f__AB01_2336_002C_4FDC();
43 43 extern void f__AB01_26EB_0047_41F4();
44 44
  45 uint16 Drivers_EnableSounds(uint16 sounds)
  46 {
  47 uint16 ret;
  48
  49 ret = g_global->soundsEnabled;
  50 g_global->soundsEnabled = sounds;
  51
  52 if (sounds == 0) {
  53 emu_push(emu_cs); emu_push(0x002A); f__1DD7_09DA_000F_D404();
  54 }
  55
  56 if (g_global->soundDriver.index != 0xFFFF || g_global->soundDriver.dcontent.csip == 0x0) return ret;
  57
  58 emu_ax = 0x1;
  59 emu_bx = g_global->soundsEnabled == 0 ? 0x10 : 0x11;
  60 emu_pushf();
  61
  62 /* Call based on memory/register values */
  63 emu_ip = g_global->soundDriver.dcontent.s.ip;
  64 emu_push(emu_cs);
  65 emu_cs = g_global->soundDriver.dcontent.s.cs;
  66 emu_push(0x0059);
  67 switch ((emu_cs << 16) + emu_ip) {
  68 default:
  69 /* In case we don't know the call point yet, call the dynamic call */
  70 emu_last_cs = 0x1DD7; emu_last_ip = 0x0056; emu_last_length = 0x002E; emu_last_crc = 0x813E;
  71 emu_call();
  72 return ret;
  73 }
  74
  75 return ret;
  76 }
  77
  78 uint16 Drivers_EnableMusic(uint16 music)
  79 {
  80 uint16 ret;
  81
  82 ret = g_global->soundsEnabled; /* Looks like a bug in original code */
  83 g_global->musicEnabled = music;
  84
  85 if (music == 0) {
  86 emu_push(emu_cs); emu_push(0x008B); f__1DD7_0A7B_001E_4A5A();
  87 }
  88
  89 if (g_global->musicDriver.index != 0xFFFF || g_global->musicDriver.dcontent.csip == 0x0) return ret;
  90
  91 emu_ax = 0x2;
  92 emu_bx = g_global->musicEnabled == 0 ? 0x10 : 0x11;
  93 emu_pushf();
  94
  95 /* Call based on memory/register values */
  96 emu_ip = g_global->musicDriver.dcontent.s.ip;
  97 emu_push(emu_cs);
  98 emu_cs = g_global->musicDriver.dcontent.s.cs;
  99 emu_push(0x00BA);
  100 switch ((emu_cs << 16) + emu_ip) {
  101 default:
  102 /* In case we don't know the call point yet, call the dynamic call */
  103 emu_last_cs = 0x1DD7; emu_last_ip = 0x00B7; emu_last_length = 0x002E; emu_last_crc = 0xB16C;
  104 emu_call();
  105 return ret;
  106 }
  107
  108 return ret;
  109 }
  110
  111
45 112 bool Drivers_Init(const char *filename, csip32 fcsip, Driver *driver, csip32 dcsip, const char *extension, uint16 variable_0008)
46 113 {
47 114 if (filename == NULL || !File_Exists(filename)) return false;
 
/trunk/src/driver.h
 
51 51 assert_compile(sizeof(MSBuffer) == 0x06);
52 52
53 53
  54 extern uint16 Drivers_EnableSounds(uint16 sounds);
  55 extern uint16 Drivers_EnableMusic(uint16 music);
54 56 extern void Drivers_All_Init(uint16 sound, uint16 music, uint16 voice);
55 57 extern csip32 Drivers_GetFunctionCSIP(uint16 driver, uint16 function);
56 58 extern csip32 Drivers_CallFunction(uint16 driver, uint16 function);
 
 
58 58 extern bool Driver_Music_IsPlaying();
59 59
60 60
  61 extern void emu_Drivers_EnableSounds();
  62 extern void emu_Drivers_EnableMusic();
61 63 extern void emu_Drivers_GetFunctionCSIP();
62 64 extern void emu_Drivers_CallFunction();
63 65 extern void emu_Driver_Music_IsPlaying();
 
/trunk/src/opendune.c
 
499 499 if (emu_ax == 0) {
500 500 emu_push(emu_cs); emu_push(0x0251); emu_cs = 0x3483; overlay(0x3483, 0); emu_Unknown_B483_0470();
501 501 if (emu_ax == 0) {
502   if (g_global->variable_700C == 0) {
  502 if (g_global->musicEnabled == 0) {
503 503 Sound_Play(2);
504 504
505 505 g_global->variable_3E52 = 0;
 
/trunk/src/unknown/emu_B483.c
 
39 39
40 40 index = emu_get_memory16(emu_ss, emu_sp, 0);
41 41
42   if (index == 0xFFFF || g_global->variable_700A == 0 || (int16)g_global->voices[index].variable_04 < (int16)g_global->variable_4060) {
  42 if (index == 0xFFFF || g_global->soundsEnabled == 0 || (int16)g_global->voices[index].variable_04 < (int16)g_global->variable_4060) {
43 43 emu_cs = ret.s.cs;
44 44 emu_ip = ret.s.ip;
45 45 return;
 
 
153 153 return;
154 154 }
155 155
156   if (g_global->variable_6D8F == 0 || g_global->variable_700A == 0 || (g_global->selectionType == 7 && g_global->variable_6D8F == 4)) {
  156 if (g_global->variable_6D8F == 0 || g_global->soundsEnabled == 0 || (g_global->selectionType == 7 && g_global->variable_6D8F == 4)) {
157 157 emu_push(g_global->variable_0312[index][6]);
158 158 emu_push(emu_cs); emu_push(0x03EC); emu_cs = 0x1DD7; f__1DD7_0477_000E_5C89();
159 159 /* Check if this overlay should be reloaded */
 
 
208 208 emu_pop(&ret.s.ip);
209 209 emu_pop(&ret.s.cs);
210 210
211   if (g_global->variable_700A == 0) {
  211 if (g_global->soundsEnabled == 0) {
212 212 emu_ax = 0;
213 213 emu_cs = ret.s.cs;
214 214 emu_ip = ret.s.ip;
 
<<   1 2 ... 1125 1126 1127 1128 1129 1130 1131   >>