1 /* $NetBSD: main.c,v 1.61 2006/03/09 18:08:32 wiz Exp $ */
4 * Copyright (c) 1999, 2000 Shin Takemura.
7 * This software is part of the PocketBSD.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the PocketBSD project
20 * and its contributors.
21 * 4. Neither the name of the project nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 #include <res/resource.h>
43 * If you modify this program and update pbsdboot.uu,
44 * change version string which is coded in main.c
47 * The version string is in format:
49 * Version A.B.C YYYY.MM.DD
53 * A: Don't change this.
54 * B: Increment this number if you change program's behavior,
55 * fix some bugs or add new features.
56 * C: Increment this number if you change/add some
57 * parameters, constants, windows' resources.
60 TCHAR
*version_string
=
61 TEXT("PocketBSD boot loader\r\n")
62 TEXT("Version 1.17.5 2001.05.05\r\n")
63 #if ( _WIN32_WCE < 200 )
64 TEXT("Compiled for WinCE 1.01\r\n")
66 TEXT("Compiled for WinCE 2.00\r\n")
69 TEXT("Copyright(C) 1999 Shin Takemura,\r\n")
70 TEXT("All rights reserved.\r\n")
72 TEXT("http://www.NetBSD.org/ports/hpcmips/\r\n");
74 /*-----------------------------------------------------------------------------
78 -----------------------------------------------------------------------------*/
94 int width
, height
, linebytes
;
96 unsigned long platid_cpu
, platid_machine
;
99 /*-----------------------------------------------------------------------------
101 variable declarations
103 -----------------------------------------------------------------------------*/
104 HINSTANCE hInst
= NULL
;
108 HWND hDlgLoad
= NULL
;
109 unsigned int dlgStatus
;
112 BOOL booting
= FALSE
;
113 int how_long_to_boot
= -1;
115 /*-----------------------------------------------------------------------------
119 -----------------------------------------------------------------------------*/
120 TCHAR szAppName
[ ] = TEXT("PocketBSD boot");
121 TCHAR szTitle
[ ] = TEXT("Welcome to PocketBSD!");
125 * Wince_conf identify executable binary file.
127 #if ( _WIN32_WCE < 200 )
128 static char *wince_conf
= "Compiled for WinCE 1.01";
130 static char *wince_conf
= "Compiled for WinCE 2.00";
133 #define IDD_TIMER 300
135 struct fb_type fb_types
[] = {
136 { BIFB_D2_M2L_3
, TEXT(BIFBN_D2_M2L_3
) },
137 { BIFB_D2_M2L_3x2
, TEXT(BIFBN_D2_M2L_3x2
) },
138 { BIFB_D2_M2L_0
, TEXT(BIFBN_D2_M2L_0
) },
139 { BIFB_D2_M2L_0x2
, TEXT(BIFBN_D2_M2L_0x2
) },
140 { BIFB_D4_M2L_F
, TEXT(BIFBN_D4_M2L_F
) },
141 { BIFB_D4_M2L_Fx2
, TEXT(BIFBN_D4_M2L_Fx2
) },
142 { BIFB_D4_M2L_0
, TEXT(BIFBN_D4_M2L_0
) },
143 { BIFB_D4_M2L_0x2
, TEXT(BIFBN_D4_M2L_0x2
) },
144 { BIFB_D8_00
, TEXT(BIFBN_D8_00
) },
145 { BIFB_D8_FF
, TEXT(BIFBN_D8_FF
) },
146 { BIFB_D16_0000
, TEXT(BIFBN_D16_0000
) },
147 { BIFB_D16_FFFF
, TEXT(BIFBN_D16_FFFF
) },
151 160, 240, 320, 400, 480, 600, 640,
152 768, 800, 1024, 1150, 1280, 1600
160 40, 80, 128, 160, 240, 256, 320,
161 384, 400, 480, 512, 600, 640, 768, 800, 1024, 1150, 1280, 1600
164 struct fb_setting fb_settings
[] = {
166 * You must choose fb_type to make the screen looks like:
167 * black-on-white on monochrome or gray scale screen
168 * white-on-black on color screen
169 * without 'reverse video' on the properties daialog.
171 * 'black-on-white' means that Foreground color is black and
172 * background color is white.
174 { NULL
, BIFB_D2_M2L_3
,
175 320, 240, 80, 0xa000000,
176 PLATID_UNKNOWN
, PLATID_UNKNOWN
},
177 { TEXT("FreeStyle"), BIFB_D2_M2L_3
,
178 320, 240, 80, 0xa000000,
179 PLATID_CPU_MIPS_VR_41XX
, PLATID_MACH_EVEREX_FREESTYLE_AXX
},
180 { TEXT("FreeStyle(Small Font)"), BIFB_D2_M2L_3x2
,
181 640, 240, 80, 0xa000000,
182 PLATID_CPU_MIPS_VR_41XX
, PLATID_MACH_EVEREX_FREESTYLE_AXX
},
183 { TEXT("MobileGear MC-CS11"), BIFB_D2_M2L_0
,
184 480, 240, 256, 0xa000000,
185 PLATID_CPU_MIPS_VR_4102
, PLATID_MACH_NEC_MCCS_11
},
186 { TEXT("MobileGear MC-CS12"), BIFB_D2_M2L_0
,
187 480, 240, 256, 0xa000000,
188 PLATID_CPU_MIPS_VR_4102
, PLATID_MACH_NEC_MCCS_12
},
189 { TEXT("MobileGear MC-CS13"), BIFB_D2_M2L_0
,
190 480, 240, 256, 0xa000000,
191 PLATID_CPU_MIPS_VR_4102
, PLATID_MACH_NEC_MCCS_13
},
192 { TEXT("Mobile Pro 700"), BIFB_D2_M2L_0
,
193 640, 240, 256, 0xa000000,
194 PLATID_CPU_MIPS_VR_4102
, PLATID_MACH_NEC_MCR_MPRO700
},
195 { TEXT("MobileGearII MC-R300"), BIFB_D2_M2L_0
,
196 640, 240, 256, 0xa000000,
197 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_NEC_MCR_300
},
198 { TEXT("MobileGearII for DoCoMo"), BIFB_D2_M2L_0
,
199 640, 240, 256, 0xa000000,
200 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_NEC_MCR_FORDOCOMO
},
201 { TEXT("MobileGearII MC-R320"), BIFB_D2_M2L_0
,
202 640, 240, 160, 0xa000000,
203 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_320
},
204 { TEXT("MobileGearII MC/R330"), BIFB_D2_M2L_0
,
205 640, 240, 160, 0xa000000,
206 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_330
},
207 { TEXT("MobileGearII MC/R430"), BIFB_D16_0000
,
208 640, 240, 1280, 0xa180100,
209 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_430
},
210 { TEXT("MobileGearII MC-R500"), BIFB_D8_00
,
211 640, 240, 1024, 0x13000000,
212 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_NEC_MCR_500
},
213 { TEXT("Mobile Pro 750c"), BIFB_D8_00
,
214 640, 240, 1024, 0x13000000,
215 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_NEC_MCR_500A
},
216 { TEXT("MobileGearII MC-R510"), BIFB_D8_00
,
217 640, 240, 1024, 0xa000000,
218 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_510
},
219 { TEXT("NEC MC-R510(15bit color)"), BIFB_D16_0000
,
220 640, 240, 1600, 0xa000000,
221 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_510
},
222 { TEXT("MobileGearII MC-R520"), BIFB_D16_0000
,
223 640, 240, 1600, 0xa000000,
224 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_520
},
225 { TEXT("NEC MC/R530(256 colors)"), BIFB_D8_00
,
226 640, 240, 640, 0xa1d4c00,
227 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_530
},
228 { TEXT("MobileGearII MC/R530"), BIFB_D16_0000
,
229 640, 240, 1280, 0xa180100,
230 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_530
},
231 { TEXT("MobileGearII MC/R550"), BIFB_D16_0000
,
232 640, 240, 1280, 0xa180100,
233 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_530
},
234 { TEXT("DoCoMo sigmarion"), BIFB_D16_0000
,
235 640, 240, 1280, 0xa000000,
236 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_SIGMARION
},
237 { TEXT("Mobile Pro 770"), BIFB_D16_0000
,
238 640, 240, 1600, 0xa000000,
239 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_520A
},
240 { TEXT("Mobile Pro 780"), BIFB_D16_0000
,
241 640, 240, 1280, 0xa180100,
242 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_530A
},
243 { TEXT("MobileGearII MC-R700"), BIFB_D16_0000
,
244 800, 600, 1600, 0xa000000,
245 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_700
},
246 { TEXT("Mobile Pro 800"), BIFB_D16_0000
,
247 800, 600, 1600, 0xa000000,
248 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_700A
},
249 { TEXT("MobileGearII MC/R730"), BIFB_D16_0000
,
250 800, 600, 1600, 0xa0ea600,
251 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_730
},
252 { TEXT("Mobile Pro 880"), BIFB_D16_0000
,
253 800, 600, 1600, 0xa0ea600,
254 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_NEC_MCR_730A
},
255 { TEXT("Tripad PV-6000"), BIFB_D8_00
,
256 640, 480, 640, 0xa000000,
257 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_SHARP_TRIPAD_PV6000
},
258 { TEXT("Vadem Clio C-1000"), BIFB_D8_00
,
259 640, 480, 640, 0xa000000,
260 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_SHARP_TRIPAD_PV6000
},
261 { TEXT("Vadem Clio C-1050"), BIFB_D16_FFFF
,
262 640, 480, 1280, 0xa200000,
263 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_SHARP_TRIPAD_PV6000
},
264 { TEXT("E-55"), BIFB_D2_M2L_0
,
265 240, 320, 256, 0xa000000,
266 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_CASIO_CASSIOPEIAE_E55
},
267 { TEXT("E-55(Small Font)"), BIFB_D2_M2L_0x2
,
268 480, 320, 256, 0xa000000,
269 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_CASIO_CASSIOPEIAE_E55
},
270 { TEXT("E-100"), BIFB_D16_FFFF
,
271 240, 320, 512, 0xa200000,
272 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_CASIO_CASSIOPEIAE_E100
},
273 { TEXT("E-500"), BIFB_D16_FFFF
,
274 240, 320, 512, 0xa200000,
275 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_CASIO_CASSIOPEIAE_E500
},
276 { TEXT("PocketPostPet"), BIFB_D16_FFFF
,
277 320, 240, 1024, 0xa200000,
278 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_CASIO_POCKETPOSTPET_POCKETPOSTPET
},
279 { TEXT("INTERTOP CX300"), BIFB_D8_00
,
280 640, 480, 640, 0xa000000,
281 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_FUJITSU_INTERTOP_IT300
},
282 { TEXT("INTERTOP CX300(16bpp)"), BIFB_D16_0000
,
283 640, 480, 1280, 0xa000000,
284 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_FUJITSU_INTERTOP_IT300
},
285 { TEXT("INTERTOP CX310"), BIFB_D8_00
,
286 640, 480, 640, 0xa000000,
287 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_FUJITSU_INTERTOP_IT310
},
288 { TEXT("PenCentra 130"), BIFB_D8_00
,
289 640, 480, 640, 0x10201e00,
290 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_FUJITSU_PENCENTRA_130
},
291 { TEXT("IBM WorkPad z50"), BIFB_D16_0000
,
292 640, 480, 1280, 0xa000000,
293 PLATID_CPU_MIPS_VR_4121
, PLATID_MACH_IBM_WORKPAD_26011AU
},
294 { TEXT("Philips Nino 312"), BIFB_D2_M2L_0
,
296 PLATID_CPU_MIPS_TX_3912
, PLATID_MACH_PHILIPS_NINO_312
},
297 { TEXT("Compaq C-series 810"), BIFB_D2_M2L_0
,
299 PLATID_CPU_MIPS_TX_3912
, PLATID_MACH_COMPAQ_C_810
},
300 { TEXT("Compaq C-series 2010c"), BIFB_D8_00
,
302 PLATID_CPU_MIPS_TX_3912
, PLATID_MACH_COMPAQ_C_2010
},
303 { TEXT("Compaq C-series 2015c"), BIFB_D8_00
,
305 PLATID_CPU_MIPS_TX_3912
, PLATID_MACH_COMPAQ_C_2015
},
306 { TEXT("Compaq PRESARIO 213"), BIFB_D8_00
,
308 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_COMPAQ_PRESARIO_213
},
309 { TEXT("Compaq Aero 1530"), BIFB_D4_M2L_F
,
310 320, 240, 160, 0x0a000000,
311 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_COMPAQ_AERO_1530
},
312 { TEXT("Aero1530(Small Font)"), BIFB_D4_M2L_Fx2
,
313 640, 240, 160, 0x0a000000,
314 PLATID_CPU_MIPS_VR_4111
, PLATID_MACH_COMPAQ_AERO_1530
},
315 { TEXT("Victor InterLink MP-C101"), BIFB_D16_0000
,
317 PLATID_CPU_MIPS_TX_3922
, PLATID_MACH_VICTOR_INTERLINK_MPC101
},
318 { TEXT("Sharp Telios HC-AJ1/AJ2"), BIFB_D16_0000
,
320 PLATID_CPU_MIPS_TX_3922
, PLATID_MACH_SHARP_TELIOS_HCAJ1
},
321 { TEXT("Sharp Telios HC-VJ1C (Japanese)"), BIFB_D16_0000
,
323 PLATID_CPU_MIPS_TX_3922
, PLATID_MACH_SHARP_TELIOS_HCVJ1C_JP
},
324 { TEXT("Sharp Mobilon HC-4100/4500"), BIFB_D2_M2L_0
, /* XXX 4bit greyscale */
326 PLATID_CPU_MIPS_TX_3912
, PLATID_MACH_SHARP_MOBILON_HC4100
},
327 { TEXT("Sharp HC-1200"), BIFB_D2_M2L_0
, /* XXX 4bit greyscale */
329 PLATID_CPU_MIPS_TX_3912
, PLATID_MACH_SHARP_MOBILON_HC1200
},
332 #define ARRAYSIZEOF(a) (sizeof(a)/sizeof(*(a)))
335 /* 'memory card' in HANKAKU KANA */
336 #define UNICODE_MEMORY_CARD \
337 TEXT('\\'), 0xff92, 0xff93, 0xff98, TEXT(' '), 0xff76, 0xff70, \
339 TCHAR unicode_memory_card
[] = { UNICODE_MEMORY_CARD
, TEXT('\\'), 0 };
340 TCHAR unicode_memory_card1
[] = { UNICODE_MEMORY_CARD
, TEXT('1'),TEXT('\\'),0 };
341 TCHAR unicode_memory_card2
[] = { UNICODE_MEMORY_CARD
, TEXT('2'),TEXT('\\'),0 };
344 #define LANGID_DEFAULT MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)
345 struct path_s path_list
[] = {
352 { TEXT("\\My Documents\\"),
354 { TEXT("\\Storage Card\\"),
355 LANGID_DEFAULT
, PATH_SAVE
},
356 { TEXT("\\Storage Card1\\"),
357 LANGID_DEFAULT
, PATH_SAVE
},
358 { TEXT("\\Storage Card2\\"),
359 LANGID_DEFAULT
, PATH_SAVE
},
361 { unicode_memory_card
,
362 MAKELANGID(LANG_JAPANESE
, SUBLANG_DEFAULT
), PATH_SAVE
},
363 { unicode_memory_card1
,
364 MAKELANGID(LANG_JAPANESE
, SUBLANG_DEFAULT
), PATH_SAVE
},
365 { unicode_memory_card2
,
366 MAKELANGID(LANG_JAPANESE
, SUBLANG_DEFAULT
), PATH_SAVE
},
369 int path_list_items
= ARRAYSIZEOF(path_list
);
371 #ifdef ADDITIONAL_KERNELS
372 TCHAR
* kernel_list
[] = {
375 int kernel_list_items
= ARRAYSIZEOF(kernel_list
);
378 /*-----------------------------------------------------------------------------
382 -----------------------------------------------------------------------------*/
383 BOOL CALLBACK
MainDlgProc(HWND
, UINT
, WPARAM
, LPARAM
);
384 LRESULT CALLBACK
WndProc(HWND
, UINT
, WPARAM
, LPARAM
);
385 void SetBootInfo(struct bootinfo
*bi
, struct fb_setting
*fbs
);
386 void wstrcpy(TCHAR
* dst
, TCHAR
* src
);
387 int reverse_fb_type(int type
);
389 /*-----------------------------------------------------------------------------
393 -----------------------------------------------------------------------------*/
394 void wstrcpy(TCHAR
* dst
, TCHAR
* src
)
402 int reverse_fb_type(int type
)
408 { BIFB_D2_M2L_3
, BIFB_D2_M2L_0
},
409 { BIFB_D2_M2L_3x2
, BIFB_D2_M2L_0x2
},
410 { BIFB_D4_M2L_F
, BIFB_D4_M2L_0
},
411 { BIFB_D4_M2L_Fx2
, BIFB_D4_M2L_0x2
},
412 { BIFB_D8_FF
, BIFB_D8_00
},
413 { BIFB_D16_FFFF
, BIFB_D16_0000
, },
416 for (i
= 0; i
< ARRAYSIZEOF(types
); i
++) {
417 if (types
[i
].type0
== type
) {
418 return (types
[i
].type1
);
420 if (types
[i
].type1
== type
) {
421 return (types
[i
].type0
);
424 debug_printf(TEXT("reverse_fb_type(): unknown type %d\n"), type
);
428 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
,
429 LPTSTR lpCmdLine
, int nCmdShow
)
434 int i
, idx
,width
,height
;
436 #if ( 200 <= _WIN32_WCE )
437 OSVERSIONINFO osverinfo
;
439 osverinfo
.dwOSVersionInfoSize
= sizeof(osverinfo
);
440 if (!GetVersionEx(&osverinfo
)) {
441 msg_printf(MSG_ERROR
,
443 TEXT("GetVersionEx() failed"));
445 osversion
= osverinfo
.dwMajorVersion
* 100 + osverinfo
.dwMinorVersion
;
451 * create log file for debugging
453 for (i
= 0; i
< path_list_items
; i
++) {
454 TCHAR filenamebuf
[1024];
455 if (!(path_list
[i
].flags
& PATH_SAVE
)) {
458 wsprintf(filenamebuf
, TEXT("%s%s"),
459 path_list
[i
].name
, LOGNAME
);
460 if (set_debug_log(filenamebuf
) == 0) {
463 TEXT("%s was created"), LOGNAME
);
468 debug_printf(TEXT("%s"), version_string
);
469 debug_printf(TEXT("Compiled for %d, Runtime OS version %d\n"),
470 _WIN32_WCE
, osversion
);
472 wc
.style
= (UINT
)NULL
;
473 wc
.lpfnWndProc
= (WNDPROC
) WndProc
;
476 wc
.hInstance
= hInstance
;
479 wc
.hbrBackground
= (HBRUSH
) GetStockObject(WHITE_BRUSH
);
480 wc
.lpszMenuName
= NULL
;
481 wc
.lpszClassName
= whoami
;
485 InitCommonControls(); // Initialize common controls - command bar
486 hInst
= hInstance
; // Save handle to create command bar
491 hBack
= CreateWindowEx(0,
506 width
= GetDeviceCaps(hdc
,HORZRES
);
507 height
= GetDeviceCaps(hdc
,VERTRES
);
511 hDlgMain
= CreateDialog(hInstance
,MAKEINTRESOURCE(IDD_MAIN_320X240
),hBack
,MainDlgProc
);
514 hDlgMain
= CreateDialog(hInstance
,MAKEINTRESOURCE(IDD_MAIN_240X320
),hBack
,MainDlgProc
);
517 SetFocus(GetDlgItem(hDlgMain
, IDC_BOOT
));
518 SetForegroundWindow(hDlgMain
);
524 if (pref_load(path_list
, path_list_items
) == 0) {
525 stat_printf(TEXT("%s is loaded."), where_pref_load_from
);
527 fb_settings
[0].type
= pref
.fb_type
;
528 fb_settings
[0].width
= pref
.fb_width
;
529 fb_settings
[0].height
= pref
.fb_height
;
530 fb_settings
[0].linebytes
= pref
.fb_linebytes
;
531 fb_settings
[0].addr
= pref
.fb_addr
;
532 fb_settings
[0].platid_cpu
= pref
.platid_cpu
;
533 fb_settings
[0].platid_machine
= pref
.platid_machine
;
535 TCHAR tmpbuf
[PATHBUFLEN
];
536 wsprintf(tmpbuf
, TEXT("%s%S"), path_list
[0].name
, "netbsd");
537 stat_printf(TEXT("preferences not loaded."));
539 pref
.setting_idx
= 1;
540 pref
.fb_type
= fb_settings
[0].type
;
541 pref
.fb_width
= fb_settings
[0].width
;
542 pref
.fb_height
= fb_settings
[0].height
;
543 pref
.fb_linebytes
= fb_settings
[0].linebytes
;
544 pref
.fb_addr
= fb_settings
[0].addr
;
545 pref
.platid_cpu
= fb_settings
[0].platid_cpu
;
546 pref
.platid_machine
= fb_settings
[0].platid_machine
;
547 wstrcpy(pref
.setting_name
, TEXT("User defined"));
548 wstrcpy(pref
.kernel_name
, tmpbuf
);
549 wstrcpy(pref
.options
, TEXT(""));
550 pref
.check_last_chance
= FALSE
;
551 pref
.load_debug_info
= FALSE
;
552 pref
.serial_port
= FALSE
;
553 pref
.reverse_video
= FALSE
;
555 fb_settings
[0].name
= pref
.setting_name
;
558 * initialize kernel file name list.
560 for (i
= 0; i
< path_list_items
; i
++) {
561 if (path_list
[i
].langid
== LANGID_DEFAULT
||
562 path_list
[i
].langid
== GetSystemDefaultLangID()) {
564 wsprintf(tmpbuf
, TEXT("%s%S"),
565 path_list
[i
].name
, "netbsd");
566 SendDlgItemMessage(hDlgMain
, IDC_KERNEL
,
567 CB_ADDSTRING
, 0, (LPARAM
)tmpbuf
);
570 #ifdef ADDITIONAL_KERNELS
571 for (i
= 0; i
< kernel_list_items
; i
++) {
572 SendDlgItemMessage(hDlgMain
, IDC_KERNEL
, CB_ADDSTRING
, 0,
573 (LPARAM
)kernel_list
[i
]);
577 SendDlgItemMessage(hDlgMain, IDC_KERNEL, CB_SETCURSEL, 0,
580 SetDlgItemText(hDlgMain
, IDC_KERNEL
, pref
.kernel_name
);
581 SetDlgItemText(hDlgMain
, IDC_OPTIONS
, pref
.options
);
584 * Frame Buffer setting names.
586 for (i
= 0; i
< ARRAYSIZEOF(fb_settings
); i
++) {
587 idx
= SendDlgItemMessage(hDlgMain
, IDC_FBSELECT
, CB_ADDSTRING
,
588 0, (LPARAM
)fb_settings
[i
].name
);
589 SendDlgItemMessage(hDlgMain
, IDC_FBSELECT
,
590 CB_SETITEMDATA
, idx
, (LPARAM
)i
);
592 user_define_idx
= idx
;
595 SendDlgItemMessage(hDlgMain
, IDC_FBSELECT
, CB_SETCURSEL
,
596 pref
.setting_idx
, (LPARAM
)NULL
);
599 if(pref
.boot_time
> 0){/* 0 can't use */
601 how_long_to_boot
= pref
.boot_time
;
602 SetTimer(hDlgMain
,IDD_TIMER
,1000,NULL
);
604 TEXT("autoboot after %d second,tap or hit any key to interrupt"),
609 * Map window and message loop
611 ShowWindow(hDlgMain
, SW_SHOW
);
612 UpdateWindow(hDlgMain
);
615 while (GetMessage(&msg
, NULL
, 0, 0)) {
616 // if (osversion < 211 ||
618 if(msg
.message
== WM_KEYDOWN
|| msg
.message
== WM_LBUTTONDOWN
){
620 how_long_to_boot
= -1;
621 KillTimer(hDlgMain
,IDD_TIMER
);
622 stat_printf(TEXT("interrupt"));
627 if(!IsDialogMessage(hDlgMain
, &msg
)) {
629 TranslateMessage(&msg
);
630 DispatchMessage(&msg
);
637 BOOL CALLBACK
DlgProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
644 case WM_PALETTECHANGED
:
649 switch (LOWORD(wParam
)) {
651 dlgStatus
= IDCANCEL
;
660 BOOL CALLBACK
DlgProc2(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
664 SetDlgItemText(hWnd
, IDC_ABOUT_EDIT
, version_string
);
667 case WM_PALETTECHANGED
:
673 switch (LOWORD(wParam
)) {
675 switch (HIWORD(wParam
)) {
677 //SendDlgItemMessage(hWnd, IDC_ABOUT_EDIT, EM_SETSEL, -1, 0);
678 SetFocus(GetDlgItem(hWnd
, IDC_ABOUT_BITMAP
));
684 EndDialog(hWnd
, LOWORD(wParam
));
695 BOOL CALLBACK
PropDlgProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
698 TCHAR tempbuf
[PATHBUFLEN
];
703 autop
= pref
.autoboot
;
705 SendDlgItemMessage(hWnd
, IDC_PAUSE
, BM_SETCHECK
,
706 pref
.check_last_chance
, 0);
707 SendDlgItemMessage(hWnd
, IDC_DEBUG
, BM_SETCHECK
,
708 pref
.load_debug_info
, 0);
709 SendDlgItemMessage(hWnd
, IDC_COMM
, BM_SETCHECK
,
710 pref
.serial_port
, 0);
711 SendDlgItemMessage(hWnd
, IDC_REVERSEVIDEO
, BM_SETCHECK
,
712 pref
.reverse_video
, 0);
713 SendDlgItemMessage(hWnd
,IDC_AUTOBOOT
,BM_SETCHECK
,pref
.autoboot
,0);
715 for (i
= 0; i
< ARRAYSIZEOF(boot_times
); i
++) {
716 wsprintf(tempbuf
, TEXT("%d"), boot_times
[i
]);
717 SendDlgItemMessage(hWnd
, IDC_BOOT_TIME
, CB_ADDSTRING
,
722 wsprintf(tempbuf
,TEXT("%d"),pref
.boot_time
);
723 SetDlgItemText(hWnd
,IDC_BOOT_TIME
,tempbuf
);
726 wsprintf(tempbuf
, TEXT("%d"), boot_times
[0]);
727 SendDlgItemMessage(hWnd
, IDC_BOOT_TIME
, CB_ADDSTRING
,
732 hwnd
= GetDlgItem(hWnd
,IDC_BOOT_TIME
);
733 EnableWindow(hwnd
,pref
.autoboot
);
737 case WM_PALETTECHANGED
:
742 switch (LOWORD(wParam
)) {
745 SendDlgItemMessage(hWnd
,IDC_AUTOBOOT
,BM_SETCHECK
,
748 hwnd
= GetDlgItem(hWnd
,IDC_BOOT_TIME
);
749 EnableWindow(hwnd
,autop
);
753 if (SendDlgItemMessage(hWnd
, IDC_PAUSE
,
754 BM_GETCHECK
, 0, 0) ==
756 pref
.check_last_chance
= TRUE
;
758 pref
.check_last_chance
= FALSE
;
761 if (SendDlgItemMessage(hWnd
, IDC_DEBUG
,
762 BM_GETCHECK
, 0, 0) ==
764 pref
.load_debug_info
= TRUE
;
766 pref
.load_debug_info
= FALSE
;
769 if (SendDlgItemMessage(hWnd
, IDC_COMM
,
770 BM_GETCHECK
, 0, 0) ==
772 pref
.serial_port
= TRUE
;
774 pref
.serial_port
= FALSE
;
777 if (SendDlgItemMessage(hWnd
, IDC_REVERSEVIDEO
,
778 BM_GETCHECK
, 0, 0) ==
780 pref
.reverse_video
= TRUE
;
782 pref
.reverse_video
= FALSE
;
785 if (SendDlgItemMessage(hWnd
, IDC_AUTOBOOT
,
786 BM_GETCHECK
, 0, 0) ==
788 pref
.autoboot
= TRUE
;
790 pref
.autoboot
= FALSE
;
792 GetDlgItemText(hWnd
,IDC_BOOT_TIME
,tempbuf
,PATHBUFLEN
);
793 pref
.boot_time
= _wtoi(tempbuf
);
808 SetBootInfo(struct bootinfo
*bi
, struct fb_setting
*fbs
)
810 TIME_ZONE_INFORMATION tz
;
812 GetTimeZoneInformation(&tz
);
813 memset(bi
, 0, sizeof(struct bootinfo
));
814 bi
->length
= sizeof(struct bootinfo
);
816 bi
->magic
= BOOTINFO_MAGIC
;
817 bi
->fb_addr
= (unsigned char*)(fbs
->addr
+ 0xA0000000);
818 bi
->fb_type
= fbs
->type
;
819 bi
->fb_line_bytes
= fbs
->linebytes
;
820 bi
->fb_width
= fbs
->width
;
821 bi
->fb_height
= fbs
->height
;
822 bi
->platid_cpu
= fbs
->platid_cpu
;
823 bi
->platid_machine
= fbs
->platid_machine
;
824 bi
->timezone
= tz
.Bias
;
826 debug_printf(TEXT("fb setting: %s fb_type=%d 0x%X %dx%d %d\n"),
828 bi
->fb_type
, bi
->fb_addr
,
829 bi
->fb_width
, bi
->fb_height
, bi
->fb_line_bytes
);
830 debug_printf(TEXT("timezone: %02ld:00\n"), (bi
->timezone
/ 60));
835 UpdateFbDlg(HWND hWnd
, struct fb_setting
*fbs
, int direction
)
838 TCHAR tmpbuf
[PATHBUFLEN
];
839 int type
, width
, height
, linebytes
;
844 SetDlgItemText(hWnd
, IDC_FB_NAME
, fbs
->name
);
846 for (i
= 0; i
< ARRAYSIZEOF(fb_types
); i
++) {
847 if (fb_types
[i
].type
== fbs
->type
) break;
849 if (ARRAYSIZEOF(fb_types
) <= i
) {
850 MessageBox(NULL
, TEXT("Unknown FrameBuffer type."),
854 debug_printf(TEXT("UpdateFbDlg(%s)\n"), fbs
->name
);
855 i
= SendDlgItemMessage(hWnd
, IDC_FB_TYPE
, CB_FINDSTRINGEXACT
,
856 0, (LPARAM
)fb_types
[i
].name
);
857 SendDlgItemMessage(hWnd
, IDC_FB_TYPE
, CB_SETCURSEL
, i
, 0);
859 wsprintf(tmpbuf
, TEXT("%X"), fbs
->addr
);
860 SetDlgItemText(hWnd
, IDC_FB_ADDR
, tmpbuf
);
861 wsprintf(tmpbuf
, TEXT("%d"), fbs
->width
);
862 SetDlgItemText(hWnd
, IDC_FB_WIDTH
, tmpbuf
);
863 wsprintf(tmpbuf
, TEXT("%d"), fbs
->height
);
864 SetDlgItemText(hWnd
, IDC_FB_HEIGHT
, tmpbuf
);
865 wsprintf(tmpbuf
, TEXT("%d"), fbs
->linebytes
);
866 SetDlgItemText(hWnd
, IDC_FB_LINEBYTES
, tmpbuf
);
867 wsprintf(tmpbuf
, TEXT("%08X"), fbs
->platid_cpu
);
868 SetDlgItemText(hWnd
, IDC_FB_CPU
, tmpbuf
);
869 wsprintf(tmpbuf
, TEXT("%08X"), fbs
->platid_machine
);
870 SetDlgItemText(hWnd
, IDC_FB_MACHINE
, tmpbuf
);
873 GetDlgItemText(hWnd
, IDC_FB_NAME
, fbs
->name
, PATHBUFLEN
);
874 type
= SendDlgItemMessage(hWnd
, IDC_FB_TYPE
,
876 type
= SendDlgItemMessage(hWnd
, IDC_FB_TYPE
,
877 CB_GETITEMDATA
, type
, 0);
878 GetDlgItemText(hWnd
, IDC_FB_WIDTH
, tmpbuf
, sizeof(tmpbuf
));
879 width
= _tcstol(tmpbuf
, NULL
, 10);
880 GetDlgItemText(hWnd
, IDC_FB_HEIGHT
, tmpbuf
, sizeof(tmpbuf
));
881 height
= _tcstol(tmpbuf
, NULL
, 10);
882 GetDlgItemText(hWnd
, IDC_FB_LINEBYTES
, tmpbuf
, sizeof(tmpbuf
));
883 linebytes
= _tcstol(tmpbuf
, NULL
, 10);
884 GetDlgItemText(hWnd
, IDC_FB_ADDR
, tmpbuf
, sizeof(tmpbuf
));
885 addr
= _tcstoul(tmpbuf
, NULL
, 16);
886 GetDlgItemText(hWnd
, IDC_FB_CPU
, tmpbuf
, sizeof(tmpbuf
));
887 fbs
->platid_cpu
= _tcstoul(tmpbuf
, NULL
, 16);
888 GetDlgItemText(hWnd
, IDC_FB_MACHINE
, tmpbuf
, sizeof(tmpbuf
));
889 fbs
->platid_machine
= _tcstoul(tmpbuf
, NULL
, 16);
893 fbs
->height
= height
;
894 fbs
->linebytes
= linebytes
;
896 debug_printf(TEXT("type=%d %dx%d %d bytes/line %08x %08x\n"),
897 type
, width
, height
, linebytes
,
899 fbs
->platid_machine
);
902 debug_printf(TEXT("UpdateFbDlg(): internal error!\n"));
907 BOOL CALLBACK
FbDlgProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
916 for (i
= 0; i
< ARRAYSIZEOF(fb_settings
); i
++) {
917 idx
= SendDlgItemMessage(hWnd
, IDC_FB_NAME
,
919 (LPARAM
)fb_settings
[i
].name
);
920 SendDlgItemMessage(hWnd
, IDC_FB_NAME
,
921 CB_SETITEMDATA
, idx
, (LPARAM
)i
);
923 for (i
= 0; i
< ARRAYSIZEOF(fb_size
); i
++) {
924 wsprintf(tmpbuf
, TEXT("%d"), fb_size
[i
]);
925 SendDlgItemMessage(hWnd
, IDC_FB_WIDTH
, CB_ADDSTRING
,
927 SendDlgItemMessage(hWnd
, IDC_FB_HEIGHT
, CB_ADDSTRING
,
930 for (i
= 0; i
< ARRAYSIZEOF(fb_bpl
); i
++) {
931 wsprintf(tmpbuf
, TEXT("%d"), fb_bpl
[i
]);
932 SendDlgItemMessage(hWnd
, IDC_FB_LINEBYTES
,
936 for (i
= 0; i
< ARRAYSIZEOF(fb_types
); i
++) {
937 idx
= SendDlgItemMessage(hWnd
, IDC_FB_TYPE
,
939 (LPARAM
)fb_types
[i
].name
);
940 SendDlgItemMessage(hWnd
, IDC_FB_TYPE
, CB_SETITEMDATA
,
941 idx
, (LPARAM
)fb_types
[i
].type
);
943 UpdateFbDlg(hWnd
, &fb_settings
[0], UPDATE_DLGBOX
);
948 SendDlgItemMessage(hWnd, IDC_FB_ADDRSPIN, UDM_SETACCEL,
952 SendDlgItemMessage(hWnd, IDC_FB_ADDRSPIN, UDM_SETRANGE,
953 0, MAKELPARAM(UD_MAXVAL, UD_MINVAL));
958 case WM_PALETTECHANGED
:
963 if ((HWND
)lParam
== GetDlgItem(hWnd
, IDC_FB_ADDRSPIN
)) {
965 switch (LOWORD(wParam
)) {
966 case SB_THUMBPOSITION
:
968 GetDlgItemText(hWnd
, IDC_FB_ADDR
, tmpbuf
, 100);
969 addr
= _tcstoul(tmpbuf
, NULL
, 16);
970 if (50 < HIWORD(wParam
)) {
975 SendDlgItemMessage(hWnd
, IDC_FB_ADDRSPIN
,
978 wsprintf(tmpbuf
, TEXT("%X"), addr
);
979 SetDlgItemText(hWnd
, IDC_FB_ADDR
, tmpbuf
);
986 switch (LOWORD(wParam
)) {
988 switch (HIWORD(wParam
)) {
990 idx
= SendDlgItemMessage(hWnd
, IDC_FB_NAME
,
992 i
= SendDlgItemMessage(hWnd
, IDC_FB_NAME
,
993 CB_GETITEMDATA
, idx
, 0);
994 if (0 <= i
&& i
< ARRAYSIZEOF(fb_settings
)) {
995 fb_settings
[0] = fb_settings
[i
];
996 UpdateFbDlg(hWnd
, &fb_settings
[0],
1003 UpdateFbDlg(hWnd
, &fb_settings
[0], UPDATE_DATA
);
1005 EndDialog(hWnd
, IDOK
);
1009 EndDialog(hWnd
, IDCANCEL
);
1018 BOOL
SerialPort(BOOL on
)
1020 static HANDLE hPort
= INVALID_HANDLE_VALUE
;
1021 BOOL res
= (hPort
!= INVALID_HANDLE_VALUE
);
1025 hPort
= CreateFile(TEXT("COM1:"),
1026 GENERIC_READ
| GENERIC_WRITE
,
1027 0, NULL
, OPEN_EXISTING
,
1030 debug_printf(TEXT("serial port ON\n"));
1031 if ( hPort
== INVALID_HANDLE_VALUE
) {
1032 debug_printf(TEXT("open failed\n"));
1037 WriteFile (hPort
, &x
, 1, &Len
, 0);
1038 WriteFile (hPort
, &x
, 1, &Len
, 0);
1039 WriteFile (hPort
, &x
, 1, &Len
, 0);
1040 WriteFile (hPort
, &x
, 1, &Len
, 0);
1044 debug_printf(TEXT("serial port OFF\n"));
1046 hPort
= INVALID_HANDLE_VALUE
;
1054 BOOL
CheckCancel(int progress
)
1058 if (0 <= progress
) {
1059 SendDlgItemMessage(hDlgLoad
, IDC_PROGRESS
,
1060 PBM_SETPOS
, (WPARAM
)progress
, (LPARAM
)NULL
);
1062 if (pref
.check_last_chance
) {
1063 if (msg_printf(MB_YESNO
| MB_ICONHAND
,
1064 TEXT("Last chance..."),
1065 TEXT("Push OK to boot.")) != IDYES
) {
1066 dlgStatus
= IDCANCEL
;
1069 palette_set(hDlgLoad
);
1070 if (palette_succeeded
== -1) {
1071 msg_printf(MSG_ERROR
,
1073 TEXT("Sorry, palette failed"));
1078 * Put WM_TIMER in my message queue.
1079 * (WM_TIMER has lowest priority.)
1081 SetTimer(hDlgLoad
, 1, 1, NULL
);
1084 * I tried PeekMessage() but it does not work.
1086 while (GetMessage(&msg
, NULL
, 0, 0)) {
1087 if (msg
.hwnd
== hDlgLoad
&& msg
.message
== WM_TIMER
) {
1090 TranslateMessage(&msg
);
1091 DispatchMessage(&msg
);
1094 return (dlgStatus
!= 0);
1097 BOOL
BootKernel(int directboot
)
1101 TCHAR wkernel_name
[PATHBUFLEN
];
1102 TCHAR woptions
[PATHBUFLEN
];
1104 char options
[PATHBUFLEN
*2], kernel_name
[PATHBUFLEN
*2];
1111 if (GetDlgItemText(hDlgMain
, IDC_KERNEL
, wkernel_name
,
1112 sizeof(wkernel_name
)) == 0) {
1113 MessageBox (NULL
, TEXT("Kernel name required"),
1117 GetDlgItemText(hDlgMain
, IDC_OPTIONS
,
1118 woptions
, sizeof(woptions
));
1119 if (wcstombs(options
, woptions
, sizeof(options
)) < 0 ||
1120 wcstombs(kernel_name
, wkernel_name
,
1121 sizeof(kernel_name
)) < 0) {
1122 MessageBox (NULL
, TEXT("invalid character"),
1128 argv
[argc
++] = kernel_name
;
1131 while (*p
== ' ' || *p
== '\t') {
1136 if (ARRAYSIZEOF(argv
) <= argc
) {
1138 TEXT("too many options"),
1145 while (*p
!= ' ' && *p
!= '\t' && *p
!= '\0') {
1154 if (ARRAYSIZEOF(argv
) < argc
) {
1159 EnableWindow(hDlgMain
, FALSE
);
1161 if (directboot
|| (MessageBox (hDlgMain
,
1162 TEXT("Data in memory will be lost.\nAre you sure?"),
1164 MB_YESNO
| MB_DEFBUTTON2
| MB_ICONHAND
) == IDYES
)) {
1169 MAKEINTRESOURCE(IDD_LOAD
),
1171 ShowWindow(hDlgLoad
, SW_SHOWNORMAL
);
1172 BringWindowToTop(hDlgLoad
);
1177 pref
.fb_type
= fb_settings
[0].type
;
1178 pref
.fb_width
= fb_settings
[0].width
;
1179 pref
.fb_height
= fb_settings
[0].height
;
1180 pref
.fb_linebytes
= fb_settings
[0].linebytes
;
1181 pref
.fb_addr
= fb_settings
[0].addr
;
1182 pref
.platid_cpu
= fb_settings
[0].platid_cpu
;
1183 pref
.platid_machine
= fb_settings
[0].platid_machine
;
1184 wstrcpy(pref
.kernel_name
, wkernel_name
);
1185 wstrcpy(pref
.options
, woptions
);
1187 pref_save(path_list
, path_list_items
);
1189 SetBootInfo(&bi
, &fb_settings
[pref
.setting_idx
]);
1190 debug_printf(TEXT("Args: "));
1191 for (i
= 0; i
< argc
; i
++) {
1192 debug_printf(TEXT("'%S' "), argv
[i
]);
1194 debug_printf(TEXT("\n"));
1195 debug_printf(TEXT("Bootinfo: fb_type=%d 0x%X %dx%d %d\n"),
1196 bi
.fb_type
, bi
.fb_addr
,
1197 bi
.fb_width
, bi
.fb_height
,
1200 if (pref
.serial_port
) {
1203 if (pref
.reverse_video
) {
1204 bi
.fb_type
= reverse_fb_type(bi
.fb_type
);
1207 * Set system information
1209 platid
.dw
.dw0
= bi
.platid_cpu
;
1210 platid
.dw
.dw1
= bi
.platid_machine
;
1211 if (set_system_info(&platid
)) {
1215 pbsdboot(wkernel_name
, argc
, argv
, &bi
);
1221 if (pref
.serial_port
) {
1225 DestroyWindow(hDlgLoad
);
1227 EnableWindow(hDlgMain
, TRUE
);
1232 LRESULT CALLBACK
WndProc(HWND hWnd
, UINT message
,
1233 WPARAM wParam
, LPARAM lParam
){
1239 case WM_PALETTECHANGED
:
1240 palette_check(hWnd
);
1243 case WM_QUERYNEWPALETTE
:
1247 sndPlaySound(TEXT("Close"), SND_NODEFAULT
| SND_ASYNC
);
1249 DestroyWindow(hWnd
);
1257 return (DefWindowProc(hWnd
, message
, wParam
, lParam
));
1263 BOOL CALLBACK
MainDlgProc(HWND hWnd
, UINT message
,
1264 WPARAM wParam
, LPARAM lParam
)
1270 sndPlaySound(TEXT("OpenProg"), SND_NODEFAULT
| SND_ASYNC
);
1271 hWndCB
= CommandBar_Create(hInst
, hWnd
, 1);
1272 CommandBar_AddAdornments(hWndCB
, STD_HELP
, (DWORD
)NULL
);
1279 hdc
= BeginPaint(hWnd
, &ps
);
1280 EndPaint(hWnd
, &ps
);
1284 case WM_PALETTECHANGED
:
1285 palette_check(hWnd
);
1290 MessageBox (NULL, TEXT("HELP NOT AVAILABLE"),
1293 DialogBox(hInst
, MAKEINTRESOURCE(IDD_ABOUT
), hWnd
, DlgProc2
);
1298 if(!booting
){/* ignore! */
1299 KillTimer(hWnd
,IDD_TIMER
);
1300 stat_printf(TEXT("interrupt2"));
1303 if(how_long_to_boot
> 0){
1306 TEXT("autoboot after %d second,tap or hit any key to interrupt"),
1310 KillTimer(hWnd
,IDD_TIMER
);
1316 switch (LOWORD(wParam
)) {
1321 if (DialogBox(hInst
, MAKEINTRESOURCE(IDD_FB
),
1322 hDlgMain
, FbDlgProc
) == IDOK
) {
1324 pref
.setting_idx
= 0;
1325 SendDlgItemMessage(hDlgMain
, IDC_FBSELECT
,
1327 (WPARAM
)user_define_idx
, 0);
1328 SendDlgItemMessage(hDlgMain
, IDC_FBSELECT
,
1330 (WPARAM
)user_define_idx
,
1331 (LPARAM
)fb_settings
[0].name
);
1332 SendDlgItemMessage(hWnd
, IDC_FBSELECT
,
1333 CB_SETCURSEL
, 0, 0);
1337 DialogBox(hInst
, MAKEINTRESOURCE(IDD_PROP
), hWnd
, PropDlgProc
);
1340 switch (HIWORD(wParam
)) {
1342 idx
= SendDlgItemMessage(hWnd
, IDC_FBSELECT
,
1343 CB_GETCURSEL
, 0, 0);
1344 i
= SendDlgItemMessage(hWnd
, IDC_FBSELECT
,
1345 CB_GETITEMDATA
, idx
, 0);
1346 if (0 <= i
&& i
< ARRAYSIZEOF(fb_settings
)) {
1347 debug_printf(TEXT("fb_setting=%d\n"), i
);
1348 pref
.setting_idx
= i
;
1357 MessageBox(NULL
, TEXT("MEMORY IS LOW"), szAppName
, MB_OK
);
1358 //Additional code to handle a low memory situation
1361 sndPlaySound(TEXT("Close"), SND_NODEFAULT
| SND_ASYNC
);
1363 DestroyWindow(hWnd
);