- Pbsdboot.exe is compiled for WindowsCE 2.00.
Use Pbsdboot1.exe for Windows CE 1.01. - Doesn't display 'MEMORI KA-DO'(Japanese KANA) if SystemDefaultLangID isn't Japanese. - Set up Windows color palette for 8 bpp machine.
This commit is contained in:
parent
847d8fd135
commit
dae2c19e55
|
@ -1,10 +1,19 @@
|
|||
# $NetBSD: Makefile,v 1.2 1999/12/04 02:43:48 takemura Exp $
|
||||
# $NetBSD: Makefile,v 1.3 2000/03/19 11:10:57 takemura Exp $
|
||||
|
||||
all: pbsdboot.exe
|
||||
|
||||
pbsdboot.exe: pbsdboot.uu
|
||||
uudecode pbsdboot.uu
|
||||
chmod 755 pbsdboot.exe
|
||||
uudecode pbsdboot1.uu
|
||||
chmod 755 pbsdboot1.exe
|
||||
|
||||
uu: WMIPSDbg/pbsdboot.exe
|
||||
uuencode WMIPSDbg/pbsdboot.exe pbsdboot.exe > pbsdboot.uu
|
||||
uu::
|
||||
if [ X"`strings WMIPSDbg/pbsdboot.exe | grep 'Compiled for WinCE'`" = \
|
||||
X'Compiled for WinCE 1.01' ]; then \
|
||||
echo This binary is compiled for WinCE 1.01; \
|
||||
uuencode WMIPSDbg/pbsdboot.exe pbsdboot1.exe > pbsdboot1.uu; \
|
||||
else \
|
||||
echo This binary is compiled for WinCE 2.00; \
|
||||
uuencode WMIPSDbg/pbsdboot.exe pbsdboot.exe > pbsdboot.uu; \
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.32 2000/03/11 09:05:17 shin Exp $ */
|
||||
/* $NetBSD: main.c,v 1.33 2000/03/19 11:10:57 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Shin Takemura.
|
||||
|
@ -39,6 +39,38 @@
|
|||
#include <commctrl.h>
|
||||
#include <res/resource.h>
|
||||
|
||||
/*
|
||||
* If you modify this program and update pbsdboot.uu,
|
||||
* change version string which is coded in main.c
|
||||
* appropriately.
|
||||
*
|
||||
* The version string is in format:
|
||||
*
|
||||
* Version A.B.C YYYY.MM.DD
|
||||
*
|
||||
* in where:
|
||||
*
|
||||
* A: Don't change this.
|
||||
* B: Increment this number if you change program's behavior,
|
||||
* fix some bugs or add new features.
|
||||
* C: Increment this number if you change/add some
|
||||
* parameters, constants, windows' resources.
|
||||
* YYYY.MM.DD: date
|
||||
*/
|
||||
TCHAR *version_string =
|
||||
TEXT("PocketBSD boot loader\r\n")
|
||||
TEXT("Version 1.11.0 2000.03.19\r\n")
|
||||
#if ( _WIN32_WCE < 200 )
|
||||
TEXT("Compiled for WinCE 1.01\r\n")
|
||||
#else
|
||||
TEXT("Compiled for WinCE 2.00\r\n")
|
||||
#endif
|
||||
TEXT("\r\n")
|
||||
TEXT("Copyright(C) 1999 Shin Takemura,\r\n")
|
||||
TEXT("All rights reserved.\r\n")
|
||||
TEXT("\r\n")
|
||||
TEXT("http://www.netbsd.org/Ports/hpcmips\r\n");
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
type difinitions
|
||||
|
@ -82,6 +114,15 @@ int user_define_idx;
|
|||
TCHAR szAppName[ ] = TEXT("PocketBSD boot");
|
||||
TCHAR szTitle[ ] = TEXT("Welcome to PocketBSD!");
|
||||
|
||||
/*
|
||||
* Wince_conf identify executable binary file.
|
||||
*/
|
||||
#if ( _WIN32_WCE < 200 )
|
||||
static char *wince_conf = "Compiled for WinCE 1.01";
|
||||
#else
|
||||
static char *wince_conf = "Compiled for WinCE 2.00";
|
||||
#endif
|
||||
|
||||
struct fb_type fb_types[] = {
|
||||
{ BIFB_D2_M2L_3, TEXT(BIFBN_D2_M2L_3) },
|
||||
{ BIFB_D2_M2L_3x2, TEXT(BIFBN_D2_M2L_3x2) },
|
||||
|
@ -238,18 +279,29 @@ TCHAR unicode_memory_card1[] = { UNICODE_MEMORY_CARD, TEXT('1'), TEXT('\\') };
|
|||
TCHAR unicode_memory_card2[] = { UNICODE_MEMORY_CARD, TEXT('2'), TEXT('\\') };
|
||||
#endif
|
||||
|
||||
TCHAR* path_list[] = {
|
||||
TEXT("/"),
|
||||
TEXT("2:/"),
|
||||
TEXT("\\"),
|
||||
TEXT("\\My Documents\\"),
|
||||
TEXT("\\Storage Card\\"),
|
||||
TEXT("\\Storage Card1\\"),
|
||||
TEXT("\\Storage Card2\\"),
|
||||
#define LANGID_DEFAULT MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)
|
||||
struct path_s path_list[] = {
|
||||
{ TEXT("/"),
|
||||
LANGID_DEFAULT, 0 },
|
||||
{ TEXT("2:/"),
|
||||
LANGID_DEFAULT, 0 },
|
||||
{ TEXT("\\"),
|
||||
LANGID_DEFAULT, 0 },
|
||||
{ TEXT("\\My Documents\\"),
|
||||
LANGID_DEFAULT, 0 },
|
||||
{ TEXT("\\Storage Card\\"),
|
||||
LANGID_DEFAULT, PATH_SAVE },
|
||||
{ TEXT("\\Storage Card1\\"),
|
||||
LANGID_DEFAULT, PATH_SAVE },
|
||||
{ TEXT("\\Storage Card2\\"),
|
||||
LANGID_DEFAULT, PATH_SAVE },
|
||||
#ifdef UNDER_CE
|
||||
unicode_memory_card,
|
||||
unicode_memory_card1,
|
||||
unicode_memory_card2,
|
||||
{ unicode_memory_card,
|
||||
MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), PATH_SAVE },
|
||||
{ unicode_memory_card1,
|
||||
MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), PATH_SAVE },
|
||||
{ unicode_memory_card2,
|
||||
MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), PATH_SAVE },
|
||||
#endif
|
||||
};
|
||||
int path_list_items = ARRAYSIZEOF(path_list);
|
||||
|
@ -384,7 +436,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
fb_settings[0].platid_machine = pref.platid_machine;
|
||||
} else {
|
||||
TCHAR tmpbuf[PATHBUFLEN];
|
||||
wsprintf(tmpbuf, TEXT("%s%S"), path_list[0], "netbsd");
|
||||
wsprintf(tmpbuf, TEXT("%s%S"), path_list[0].name, "netbsd");
|
||||
SetDlgItemText(hWndMain, IDC_STATUS,
|
||||
TEXT("preferences not loaded."));
|
||||
|
||||
|
@ -410,10 +462,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
* initialize kernel file name list.
|
||||
*/
|
||||
for (i = 0; i < path_list_items; i++) {
|
||||
TCHAR tmpbuf[1024];
|
||||
wsprintf(tmpbuf, TEXT("%s%S"), path_list[i], "netbsd");
|
||||
SendDlgItemMessage(hWndMain, IDC_KERNEL, CB_ADDSTRING, 0,
|
||||
(LPARAM)tmpbuf);
|
||||
if (path_list[i].langid == LANGID_DEFAULT ||
|
||||
path_list[i].langid == GetSystemDefaultLangID()) {
|
||||
TCHAR tmpbuf[1024];
|
||||
wsprintf(tmpbuf, TEXT("%s%S"),
|
||||
path_list[i].name, "netbsd");
|
||||
SendDlgItemMessage(hWndMain, IDC_KERNEL,
|
||||
CB_ADDSTRING, 0, (LPARAM)tmpbuf);
|
||||
}
|
||||
}
|
||||
#ifdef ADDITIONAL_KERNELS
|
||||
for (i = 0; i < kernel_list_items; i++) {
|
||||
|
@ -474,6 +530,10 @@ BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case WM_INITDIALOG:
|
||||
return (1);
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
palette_check(hWnd);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
|
@ -490,35 +550,13 @@ BOOL CALLBACK DlgProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
/*
|
||||
* If you modify this program and update pbsdboot.uu,
|
||||
* change version string which is coded in main.c
|
||||
* appropriately.
|
||||
*
|
||||
* The version string is in format:
|
||||
*
|
||||
* Version A.B.C YYYY.MM.DD
|
||||
*
|
||||
* in where:
|
||||
*
|
||||
* A: Don't change this.
|
||||
* B: Increment this number if you change program's behavior,
|
||||
* fix some bugs or add new features.
|
||||
* C: Increment this number if you change/add some
|
||||
* parameters, constants, windows' resources.
|
||||
* YYYY.MM.DD: date
|
||||
*/
|
||||
SetDlgItemText(hWnd, IDC_ABOUT_EDIT,
|
||||
TEXT("PocketBSD boot loader\r\n")
|
||||
TEXT("Version 1.10.2 2000.02.27\r\n")
|
||||
TEXT("\r\n")
|
||||
TEXT("Copyright(C) 1999 Shin Takemura,\r\n")
|
||||
TEXT("All rights reserved.\r\n")
|
||||
TEXT("\r\n")
|
||||
TEXT("http://www02.u-page.so-net.ne.jp/ca2/takemura/\r\n")
|
||||
);
|
||||
SetDlgItemText(hWnd, IDC_ABOUT_EDIT, version_string);
|
||||
return (1);
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
palette_check(hWnd);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_ABOUT_EDIT:
|
||||
|
@ -691,6 +729,10 @@ BOOL CALLBACK FbDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
return (1);
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
palette_check(hWnd);
|
||||
break;
|
||||
|
||||
case WM_VSCROLL:
|
||||
if ((HWND)lParam == GetDlgItem(hWnd, IDC_FB_ADDRSPIN)) {
|
||||
long addr;
|
||||
|
@ -790,12 +832,19 @@ BOOL CheckCancel(int progress)
|
|||
if (0 <= progress) {
|
||||
SendDlgItemMessage(hDlgLoad, IDC_PROGRESS,
|
||||
PBM_SETPOS, (WPARAM)progress, (LPARAM)NULL);
|
||||
} else
|
||||
if (pref.check_last_chance) {
|
||||
if (msg_printf(MB_YESNO | MB_ICONHAND,
|
||||
TEXT("Last chance..."),
|
||||
TEXT("Push OK to boot.")) != IDYES) {
|
||||
dlgStatus = IDCANCEL;
|
||||
} else {
|
||||
if (pref.check_last_chance) {
|
||||
if (msg_printf(MB_YESNO | MB_ICONHAND,
|
||||
TEXT("Last chance..."),
|
||||
TEXT("Push OK to boot.")) != IDYES) {
|
||||
dlgStatus = IDCANCEL;
|
||||
}
|
||||
}
|
||||
palette_set(hDlgLoad);
|
||||
if (palette_succeeded == -1) {
|
||||
msg_printf(MSG_ERROR,
|
||||
TEXT("Warning"),
|
||||
TEXT("Sorry, palette failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -827,10 +876,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
|
|||
switch (message) {
|
||||
case WM_CREATE:
|
||||
sndPlaySound(TEXT("OpenProg"), SND_NODEFAULT | SND_ASYNC);
|
||||
|
||||
hWndCB = CommandBar_Create(hInst, hWnd, 1);
|
||||
CommandBar_AddAdornments(hWndCB, STD_HELP, (DWORD)NULL);
|
||||
|
||||
palette_init(hWnd);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
|
@ -843,6 +891,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
palette_check(hWnd);
|
||||
break;
|
||||
|
||||
case WM_HELP:
|
||||
/*
|
||||
MessageBox (NULL, TEXT("HELP NOT AVAILABLE"),
|
||||
|
@ -969,28 +1021,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
|
|||
wstrcpy(pref.kernel_name, wkernel_name);
|
||||
wstrcpy(pref.options, woptions);
|
||||
|
||||
if (where_pref_load_from) {
|
||||
pref_write(where_pref_load_from, &pref);
|
||||
} else {
|
||||
TCHAR *p, t;
|
||||
TCHAR *last_separator = NULL;
|
||||
TCHAR tmpbuf[PATHBUFLEN];
|
||||
for (p = wkernel_name; *p != 0; p++) {
|
||||
if (*p == TEXT('\\')) {
|
||||
last_separator = p;
|
||||
}
|
||||
}
|
||||
if (last_separator != NULL) {
|
||||
p = last_separator + 1;
|
||||
}
|
||||
t = *p;
|
||||
*p = 0;
|
||||
wsprintf(tmpbuf,
|
||||
TEXT("%s%s"),
|
||||
wkernel_name, PREFNAME);
|
||||
*p = t;
|
||||
pref_write(tmpbuf, &pref);
|
||||
}
|
||||
pref_save(path_list, path_list_items);
|
||||
|
||||
SetBootInfo(&bi, &fb_settings[pref.setting_idx]);
|
||||
debug_printf(TEXT("Args: "));
|
||||
|
|
|
@ -0,0 +1,231 @@
|
|||
/* $NetBSD: palette.c,v 1.1 2000/03/19 11:10:58 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Shin Takemura.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is part of the PocketBSD.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the PocketBSD project
|
||||
* and its contributors.
|
||||
* 4. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#include <pbsdboot.h>
|
||||
|
||||
/*
|
||||
* If Windows have no color palette, we have nothing to do here.
|
||||
*/
|
||||
#if ( _WIN32_WCE >= 200 ) // WIN CE Ver 2.00 or greater
|
||||
#define HAVE_COLOR_PALETTE
|
||||
#endif
|
||||
|
||||
#define ASSERT(a) \
|
||||
if (!(a)) { \
|
||||
msg_printf(MSG_ERROR, TEXT("assertion failure"), \
|
||||
TEXT(#a)); \
|
||||
}
|
||||
|
||||
#ifdef HAVE_COLOR_PALETTE
|
||||
enum palette_status palette_succeeded = PAL_ERROR;
|
||||
static void palette_setup(PALETTEENTRY *pal);
|
||||
#else
|
||||
enum palette_status palette_succeeded = PAL_NOERROR;
|
||||
#endif
|
||||
|
||||
static u_char compo6[6] = { 0, 51, 102, 153, 204, 255 };
|
||||
static u_char compo7[7] = { 0, 42, 85, 127, 170, 212, 255 };
|
||||
static HPALETTE pal = NULL;
|
||||
|
||||
void
|
||||
palette_init(HWND hWnd)
|
||||
{
|
||||
#ifdef HAVE_COLOR_PALETTE
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
LOGPALETTE* logpal;
|
||||
|
||||
debug_printf(TEXT("*** palette init ***\n"));
|
||||
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
if (GetDeviceCaps(hdc, TECHNOLOGY) == DT_RASDISPLAY &&
|
||||
(GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) &&
|
||||
GetDeviceCaps(hdc, COLORRES) == 8) {
|
||||
ASSERT(GetDeviceCaps(hdc, BITSPIXEL) == 8);
|
||||
ASSERT(GetDeviceCaps(hdc, PLANES) == 1);
|
||||
/*
|
||||
* create logical palette
|
||||
*/
|
||||
logpal = LocalAlloc (LPTR,
|
||||
(sizeof(LOGPALETTE) +
|
||||
sizeof(PALETTEENTRY) * 256));
|
||||
logpal->palVersion = 0x300;
|
||||
logpal->palNumEntries = 256;
|
||||
palette_setup(logpal->palPalEntry);
|
||||
|
||||
pal = CreatePalette(logpal);
|
||||
if (pal == NULL) {
|
||||
debug_printf(TEXT("CreatePalette() failed"));
|
||||
msg_printf(MSG_ERROR, TEXT("Error"),
|
||||
TEXT("CreatePalette() failed: %d"),
|
||||
GetLastError());
|
||||
}
|
||||
LocalFree((HLOCAL)logpal);
|
||||
} else {
|
||||
/*
|
||||
* The screen is not 8 bit depth nor indexed color.
|
||||
*/
|
||||
palette_succeeded = PAL_NOERROR;
|
||||
}
|
||||
EndPaint(hWnd, &ps);
|
||||
#endif /* HAVE_COLOR_PALETTE */
|
||||
}
|
||||
|
||||
#ifdef HAVE_COLOR_PALETTE
|
||||
static void
|
||||
palette_setup(PALETTEENTRY *pal)
|
||||
{
|
||||
int i, r, g, b;
|
||||
|
||||
/*
|
||||
* 0 - 31, gray scale
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
pal[i].peFlags = PC_EXPLICIT;
|
||||
pal[i].peRed = i * 8;
|
||||
pal[i].peGreen = i * 8;
|
||||
pal[i].peBlue = i * 8;
|
||||
}
|
||||
/*
|
||||
* 32 - 247, RGB color
|
||||
*/
|
||||
for (r = 0; r < 6; r++) {
|
||||
for (g = 0; g < 6; g++) {
|
||||
for (b = 0; b < 6; b++) {
|
||||
pal[i].peFlags = PC_EXPLICIT;
|
||||
pal[i].peRed = compo6[r];
|
||||
pal[i].peGreen = compo6[g];
|
||||
pal[i].peBlue = compo6[b];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 248 - 255, just white
|
||||
*/
|
||||
for ( ; i < 256; i++) {
|
||||
pal[i].peFlags = PC_EXPLICIT;
|
||||
pal[i].peRed = 255;
|
||||
pal[i].peGreen = 255;
|
||||
pal[i].peBlue = 255;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_COLOR_PALETTE */
|
||||
|
||||
void
|
||||
palette_set(HWND hWnd)
|
||||
{
|
||||
#ifdef HAVE_COLOR_PALETTE
|
||||
int n;
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
HPALETTE prev_pal;
|
||||
|
||||
debug_printf(TEXT("*** palette set ***\n"));
|
||||
|
||||
if (pal != NULL) {
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
prev_pal = SelectPalette(hdc, pal, FALSE);
|
||||
if (prev_pal == NULL) {
|
||||
debug_printf(TEXT("SelectPalette() failed"));
|
||||
msg_printf(MSG_ERROR, TEXT("Error"),
|
||||
TEXT("SelectPalette() failed: %d"),
|
||||
GetLastError());
|
||||
} else {
|
||||
n = RealizePalette(hdc);
|
||||
debug_printf(TEXT("RealizePalette() = %d\n"), n);
|
||||
if (n == GDI_ERROR) {
|
||||
debug_printf(TEXT("RealizePalette() failed"));
|
||||
msg_printf(MSG_ERROR, TEXT("Error"),
|
||||
TEXT("RealizePalette() failed: %d"),
|
||||
GetLastError());
|
||||
}
|
||||
}
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
#endif /* HAVE_COLOR_PALETTE */
|
||||
}
|
||||
|
||||
void
|
||||
palette_check(HWND hWnd)
|
||||
{
|
||||
#ifdef HAVE_COLOR_PALETTE
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
PALETTEENTRY syspal[256];
|
||||
PALETTEENTRY canonpal[256];
|
||||
int i, n, error;
|
||||
|
||||
debug_printf(TEXT("*** palette check ***\n"));
|
||||
|
||||
error = 0;
|
||||
if (pal != NULL) {
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
|
||||
palette_setup(canonpal);
|
||||
|
||||
n = GetSystemPaletteEntries(hdc, 0, 256, syspal);
|
||||
if (n == 0) {
|
||||
msg_printf(MSG_ERROR, TEXT("Error"),
|
||||
TEXT("GetSystemPaletteEntries() failed: %d"),
|
||||
GetLastError());
|
||||
error++;
|
||||
} else {
|
||||
for (i = 0; i < n; i++) {
|
||||
debug_printf(TEXT("%3d: %02x %02x %02x"),
|
||||
i,
|
||||
syspal[i].peRed,
|
||||
syspal[i].peGreen,
|
||||
syspal[i].peBlue);
|
||||
if (syspal[i].peRed != canonpal[i].peRed ||
|
||||
syspal[i].peGreen != canonpal[i].peGreen ||
|
||||
syspal[i].peBlue != canonpal[i].peBlue ) {
|
||||
debug_printf(TEXT(" *"));
|
||||
error++;
|
||||
}
|
||||
debug_printf(TEXT("\n"));
|
||||
}
|
||||
}
|
||||
EndPaint(hWnd, &ps);
|
||||
if (error) {
|
||||
palette_succeeded = PAL_ERROR;
|
||||
} else {
|
||||
palette_succeeded = PAL_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_COLOR_PALETTE */
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pbsdboot.c,v 1.2 2000/01/16 03:07:32 takemura Exp $ */
|
||||
/* $NetBSD: pbsdboot.c,v 1.3 2000/03/19 11:10:58 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Shin Takemura.
|
||||
|
@ -80,6 +80,7 @@ pbsdboot(TCHAR *wkernel_name, int argc, char *argv[], struct bootinfo* bi)
|
|||
goto cancel;
|
||||
}
|
||||
|
||||
/* last chance to cancel */
|
||||
if (CheckCancel(-1)) {
|
||||
goto cancel;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: pbsdboot.config,v 1.5 2000/02/06 08:47:19 takemura Exp $
|
||||
# $NetBSD: pbsdboot.config,v 1.6 2000/03/19 11:10:58 takemura Exp $
|
||||
|
||||
# config file/script to generate project file (.dsp) for pbsdboot
|
||||
|
||||
|
@ -12,6 +12,7 @@ SRCFILE_LIST='
|
|||
layout.c
|
||||
main.c
|
||||
mips.c
|
||||
palette.c
|
||||
pbsdboot.c
|
||||
platid.c
|
||||
platid_mask.c
|
||||
|
|
|
@ -121,6 +121,10 @@ SOURCE=.\mips.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\palette.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pbsdboot.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pbsdboot.h,v 1.7 2000/01/31 12:45:29 takemura Exp $ */
|
||||
/* $NetBSD: pbsdboot.h,v 1.8 2000/03/19 11:10:58 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Shin Takemura.
|
||||
|
@ -86,6 +86,13 @@ struct preference_s {
|
|||
BOOL reverse_video;
|
||||
};
|
||||
|
||||
struct path_s {
|
||||
TCHAR* name;
|
||||
LANGID langid;
|
||||
unsigned long flags;
|
||||
#define PATH_SAVE 1
|
||||
};
|
||||
|
||||
/*
|
||||
* Machine dependent information
|
||||
*/
|
||||
|
@ -162,7 +169,8 @@ void hardware_test(void);
|
|||
void pref_init(struct preference_s* pref);
|
||||
void pref_dump(struct preference_s* pref);
|
||||
int pref_read(TCHAR* filename, struct preference_s* pref);
|
||||
int pref_load(TCHAR* load_path[], int pathlen);
|
||||
int pref_load(struct path_s load_path[], int pathlen);
|
||||
int pref_save(struct path_s load_path[], int pathlen);
|
||||
int pref_write(TCHAR* filename, struct preference_s* buf);
|
||||
|
||||
|
||||
|
@ -172,6 +180,15 @@ int pref_write(TCHAR* filename, struct preference_s* buf);
|
|||
int set_system_info(platid_t* platid);
|
||||
|
||||
|
||||
/*
|
||||
* palette.c
|
||||
*/
|
||||
enum palette_status { PAL_ERROR, PAL_NOERROR, PAL_SUCCEEDED };
|
||||
extern enum palette_status palette_succeeded;
|
||||
void palette_init(HWND hWnd);
|
||||
void palette_set(HWND hWnd);
|
||||
void palette_check(HWND hWnd);
|
||||
|
||||
/*
|
||||
* vr41xx.c
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: preference.c,v 1.2 2000/01/16 03:07:33 takemura Exp $ */
|
||||
/* $NetBSD: preference.c,v 1.3 2000/03/19 11:10:59 takemura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Shin Takemura.
|
||||
|
@ -119,14 +119,14 @@ pref_read(TCHAR* filename, struct preference_s* pref)
|
|||
|
||||
|
||||
int
|
||||
pref_load(TCHAR* load_path[], int pathlen)
|
||||
pref_load(struct path_s load_path[], int pathlen)
|
||||
{
|
||||
int i;
|
||||
|
||||
where_pref_load_from = NULL;
|
||||
for (i = 0; i < pathlen; i++) {
|
||||
wsprintf(filenamebuf, TEXT("%s%s"),
|
||||
load_path[i], PREFNAME);
|
||||
load_path[i].name, PREFNAME);
|
||||
debug_printf(TEXT("pref_load: try to '%s'\n"), filenamebuf);
|
||||
if (pref_read(filenamebuf, &pref) == 0) {
|
||||
debug_printf(TEXT("pref_load: succeded, '%s'.\n"),
|
||||
|
@ -141,6 +141,40 @@ pref_load(TCHAR* load_path[], int pathlen)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
pref_save(struct path_s load_path[], int pathlen)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (where_pref_load_from) {
|
||||
if (pref_write(where_pref_load_from, &pref) != 0) {
|
||||
msg_printf(MSG_ERROR, TEXT("Error()"),
|
||||
TEXT("Can't write %s"), where_pref_load_from);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < pathlen; i++) {
|
||||
if (!(load_path[i].flags & PATH_SAVE)) {
|
||||
continue;
|
||||
}
|
||||
wsprintf(filenamebuf, TEXT("%s%s"),
|
||||
load_path[i].name, PREFNAME);
|
||||
debug_printf(TEXT("pref_save: try to '%s'\n"), filenamebuf);
|
||||
if (pref_write(filenamebuf, &pref) == 0) {
|
||||
debug_printf(TEXT("pref_write: succeded, '%s'.\n"),
|
||||
filenamebuf);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
msg_printf(MSG_ERROR, TEXT("Error()"),
|
||||
TEXT("Can't write %s"), PREFNAME);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pref_write(TCHAR* filename, struct preference_s* buf)
|
||||
{
|
||||
|
@ -161,8 +195,6 @@ pref_write(TCHAR* filename, struct preference_s* buf)
|
|||
);
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE) {
|
||||
msg_printf(MSG_ERROR, TEXT("pref_write()"),
|
||||
TEXT("CreateFile(): error=%d"), GetLastError());
|
||||
debug_printf(TEXT("CreateFile(): error=%d\n"), GetLastError());
|
||||
return (-1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue