| /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/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 |
} |
| |