Changelog
Revision 1127
Author glx
Date 27/05/2010 13:00:42
Message -Add: C-ified GameOptions_Load() and GameOptions_Save()
Changed files: (view/hide)
/trunk/decompiled/cs__B4F2.c
 
5 5 #include "decompiled.h"
6 6
7 7 /**
8   * Decompiled function emu_GameOptions_Load()
9   *
10   * @name emu_GameOptions_Load
11   * @implements B4F2:0000:000D:C9F0 ()
12   * @implements B4F2:000D:001C:9C78
13   * @implements B4F2:0029:000C:02B1
14   * @implements B4F2:0035:000A:8FD3
15   * @implements B4F2:003F:000C:04DE
16   * @implements B4F2:0049:0002:C23A
17   * @implements B4F2:004B:0004:9539
18   * @implements B4F2:004F:0002:2597
19   *
20   * Called From: 34F2:0020:0005:0000
21   */
22   void emu_GameOptions_Load()
23   {
24   l__0000:
25   emu_push(emu_bp);
26   emu_bp = emu_sp;
27   emu_push(emu_ds);
28   emu_ax = 0x2AB7;
29   emu_push(emu_ax);
30   emu_push(emu_cs); emu_push(0x000D); emu_cs = 0x1FB5; emu_File_Exists();
31   /* Check if this overlay should be reloaded */
32   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
33   l__000D:
34   emu_pop(&emu_cx);
35   emu_pop(&emu_cx);
36   emu_orw(&emu_ax, emu_ax);
37   if (emu_ax == 0) goto l__004B;
38   emu_xorw(&emu_ax, emu_ax);
39   emu_dx = 0xA;
40   emu_push(emu_ax);
41   emu_push(emu_dx);
42   emu_push(emu_ds);
43   emu_ax = 0x41C2;
44   emu_push(emu_ax);
45   emu_push(emu_ds);
46   emu_ax = 0x2AB7;
47   emu_push(emu_ax);
48   emu_push(emu_cs); emu_push(0x0029); emu_cs = 0x253D; emu_File_ReadBlockFile();
49   /* Check if this overlay should be reloaded */
50   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
51   l__0029:
52   emu_addw(&emu_sp, 0xC);
53   emu_push(emu_get_memory16(emu_ds, 0x00, 0x41C2));
54   emu_push(emu_cs); emu_push(0x0035); emu_cs = 0x1DD7; f__1DD7_006F_001C_4403();
55   /* Check if this overlay should be reloaded */
56   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
57   l__0035:
58   emu_pop(&emu_cx);
59   emu_push(emu_get_memory16(emu_ds, 0x00, 0x41C4));
60   emu_push(emu_cs); emu_push(0x003F); emu_cs = 0x1DD7; f__1DD7_000E_001C_4593();
61   /* Check if this overlay should be reloaded */
62   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
63   l__003F:
64   emu_pop(&emu_cx);
65   emu_ax = emu_get_memory16(emu_ds, 0x00, 0x41C6);
66   emu_get_memory16(emu_ds, 0x00, 0x3900) = emu_ax;
67   emu_ax = 0x1;
68   l__0049:
69   goto l__004F;
70   l__004B:
71   emu_xorw(&emu_ax, emu_ax);
72   goto l__0049;
73   l__004F:
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 emu_GameOptions_Save()
84   *
85   * @name emu_GameOptions_Save
86   * @implements B4F2:0051:0012:A048 ()
87   * @implements B4F2:0063:0017:F3DE
88   * @implements B4F2:007A:0009:2605
89   * @implements B4F2:0083:0010:7381
90   * @implements B4F2:0093:0006:B1FB
91   * @implements B4F2:0094:0005:D5FA
92   * @implements B4F2:0099:0003:2E57
93   *
94   * Called From: B4F2:0338:0005:014D
95   */
96   void emu_GameOptions_Save()
97   {
98   l__0051:
99   emu_push(emu_bp);
100   emu_bp = emu_sp;
101   emu_push(emu_si);
102   emu_ax = 0x2;
103   emu_push(emu_ax);
104   emu_push(emu_ds);
105   emu_ax = 0x2AB7;
106   emu_push(emu_ax);
107   emu_push(emu_cs); emu_push(0x0063); emu_cs = 0x1FB5; emu_File_Open();
108   /* Check if this overlay should be reloaded */
109   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
110   l__0063:
111   emu_addw(&emu_sp, 0x6);
112   emu_si = emu_ax;
113   emu_xorw(&emu_ax, emu_ax);
114   emu_dx = 0xA;
115   emu_push(emu_ax);
116   emu_push(emu_dx);
117   emu_push(emu_ds);
118   emu_ax = 0x41C2;
119   emu_push(emu_ax);
120   emu_push(emu_si);
121   emu_push(emu_cs); emu_push(0x007A); emu_cs = 0x1FB5; emu_File_Write();
122   /* Check if this overlay should be reloaded */
123   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
124   l__007A:
125   emu_addw(&emu_sp, 0xA);
126   emu_push(emu_si);
127   emu_push(emu_cs); emu_push(0x0083); emu_cs = 0x1FB5; emu_File_Close();
128   /* Check if this overlay should be reloaded */
129   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
130   l__0083:
131   emu_pop(&emu_cx);
132   emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x41C2), 0x0);
133   if (emu_get_memory16(emu_ds, 0x00, 0x41C2) != 0x0) goto l__0094;
134   emu_xorw(&emu_ax, emu_ax);
135   emu_push(emu_ax);
136   emu_push(emu_cs); emu_push(0x0093); emu_cs = 0x3483; overlay(0x3483, 0); emu_Sound_Play();
137   /* Check if this overlay should be reloaded */
138   if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
139   l__0093:
140   emu_pop(&emu_cx);
141   l__0094:
142   emu_ax = 0x1;
143   goto l__0099;
144   l__0099:
145   emu_pop(&emu_si);
146   emu_pop(&emu_bp);
147  
148   /* Return from this function */
149   emu_pop(&emu_ip);
150   emu_pop(&emu_cs);
151   return;
152   }
153  
154   /**
155 8 * Decompiled function emu_GUI_Options()
156 9 *
157 10 * @name emu_GUI_Options
 
/trunk/decompiled/decompiled.h
 
67 67 extern void f__B4E6_0000_001A_C6C7();
68 68 extern void f__B4E9_0000_0013_DC68();
69 69 extern void f__B4ED_0000_0079_AC5D();
70   extern void emu_GameOptions_Load();
71 70 extern void emu_Ini_GetInteger();
72 71 extern void f__B500_0000_0008_FE1F();
73 72 extern void emu_GUI_ShowMap();
 
 
135 135 extern void f__2BF2_0040_000E_71D1();
136 136 extern void f__2BB6_004F_0014_AB2C();
137 137 extern void f__B4E9_0050_003F_292A();
138   extern void emu_GameOptions_Save();
139 138 extern void f__2649_0053_001D_FEB5();
140 139 extern void f__260F_0054_0016_0011();
141 140 extern void emu_Mouse_EventHandler();
 
/trunk/src/config.c
 
6 6 #include "types.h"
7 7 #include "libemu.h"
8 8 #include "config.h"
  9 #include "global.h"
  10 #include "file.h"
9 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
10 16 /**
11 17 * Reads and decode the config.
12 18 *
 
 
53 53
54 54 return (sum == config->checksum);
55 55 }
  56
  57 /**
  58 * Loads the game options.
  59 *
  60 * @return True if loading is successful.
  61 */
  62 bool GameOptions_Load()
  63 {
  64 if (!File_Exists(g_global->string_2AB7)) return false;
  65
  66 File_ReadBlockFile(g_global->string_2AB7, &g_global->gameConfig, sizeof(g_global->gameConfig));
  67
  68 emu_push(g_global->gameConfig.music);
  69 emu_push(emu_cs); emu_push(0x0035); emu_cs = 0x1DD7; f__1DD7_006F_001C_4403();
  70 /* Check if this overlay should be reloaded */
  71 if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
  72 emu_sp += 2;
  73
  74 emu_push(g_global->gameConfig.sounds);
  75 emu_push(emu_cs); emu_push(0x003F); emu_cs = 0x1DD7; f__1DD7_000E_001C_4593();
  76 /* Check if this overlay should be reloaded */
  77 if (emu_cs == 0x34F2) { overlay(0x34F2, 1); }
  78 emu_sp += 2;
  79
  80 g_global->gameSpeed = g_global->gameConfig.gameSpeed;
  81
  82 return true;
  83 }
  84
  85 /**
  86 * Saves the game options.
  87 */
  88 void GameOptions_Save()
  89 {
  90 uint8 index;
  91
  92 index = File_Open(g_global->string_2AB7, 2);
  93
  94 File_Write(index, &g_global->gameConfig, sizeof(g_global->gameConfig));
  95
  96 File_Close(index);
  97
  98 if (g_global->gameConfig.music == 0) Sound_Play(0);
  99 }
 
/trunk/src/config.h
 
40 40
41 41
42 42 extern bool Config_Read(char *filename, DuneCfg *config);
  43 extern bool GameOptions_Load();
  44 extern void GameOptions_Save();
43 45
  46 extern void emu_GameOptions_Load();
  47 extern void emu_GameOptions_Save();
  48
44 49 #endif /* CONFIG_H */
 
/trunk/src/emu_config.c
 
  0 /* $Id$ */
  1
  2 #include <assert.h>
  3 #include <stdio.h>
  4 #include <string.h>
  5 #include "types.h"
  6 #include "libemu.h"
  7 #include "config.h"
  8
  9 /**
  10 * Emulator wrapper around GameOptions_Load()
  11 *
  12 * @name emu_GameOptions_Load
  13 * @implements B4F2:0000:000D:C9F0 ()
  14 */
  15 void emu_GameOptions_Load()
  16 {
  17 csip32 ret;
  18
  19 /* Pop the return CS:IP. */
  20 emu_pop(&ret.s.ip);
  21 emu_pop(&ret.s.cs);
  22
  23 emu_ax = GameOptions_Load() ? 1 : 0;
  24
  25 emu_cs = ret.s.cs;
  26 emu_ip = ret.s.ip;
  27 }
  28
  29 /**
  30 * Emulator wrapper around GameOptions_Save()
  31 *
  32 * @name emu_GameOptions_Save
  33 * @implements B4F2:0051:0012:A048 ()
  34 */
  35 void emu_GameOptions_Save()
  36 {
  37 /* Pop the return CS:IP. */
  38 emu_pop(&emu_ip);
  39 emu_pop(&emu_cs);
  40
  41 GameOptions_Save();
  42 }
0 43
 
/trunk/projects/opendune.vcproj
 
2077 2077 >
2078 2078 </File>
2079 2079 <File
  2080 RelativePath="..\src\emu_config.c"
  2081 >
  2082 <FileConfiguration
  2083 Name="Debug|Win32"
  2084 >
  2085 <Tool
  2086 Name="VCCLCompilerTool"
  2087 ObjectFile="$(IntDir)\src\"
  2088 />
  2089 </FileConfiguration>
  2090 <FileConfiguration
  2091 Name="Release|Win32"
  2092 >
  2093 <Tool
  2094 Name="VCCLCompilerTool"
  2095 ObjectFile="$(IntDir)\src\"
  2096 />
  2097 </FileConfiguration>
  2098 </File>
  2099 <File
2080 2100 RelativePath="..\src\emu_driver.c"
2081 2101 >
2082 2102 <FileConfiguration
 
<<   1 2 ... 1124 1125 1126 1127 1128 1129 1130   >>