diff options
author | shaun <shaun@FreeBSD.org> | 2015-01-27 08:25:14 +0800 |
---|---|---|
committer | shaun <shaun@FreeBSD.org> | 2015-01-27 08:25:14 +0800 |
commit | 4d75b2c0ec38bec8d38c5a9139ffe14edfdadbde (patch) | |
tree | b4c0c8aedbce5ebe581d0020b6bd6342837c6218 /emulators | |
parent | 41774ab91c9ab1cafc9ea3694f0486a6d3421798 (diff) | |
download | freebsd-ports-gnome-4d75b2c0ec38bec8d38c5a9139ffe14edfdadbde.tar.gz freebsd-ports-gnome-4d75b2c0ec38bec8d38c5a9139ffe14edfdadbde.tar.zst freebsd-ports-gnome-4d75b2c0ec38bec8d38c5a9139ffe14edfdadbde.zip |
- Fix build.
- Add (optional) patch to bring grayscale support to the calculator.
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/x49gp/Makefile | 11 | ||||
-rw-r--r-- | emulators/x49gp/files/grayscale.diff | 203 |
2 files changed, 212 insertions, 2 deletions
diff --git a/emulators/x49gp/Makefile b/emulators/x49gp/Makefile index 1ddcbf1b98fb..37d1e22ae154 100644 --- a/emulators/x49gp/Makefile +++ b/emulators/x49gp/Makefile @@ -31,7 +31,10 @@ OPTIONS_SINGLE_FIRMWARE=FIRMWARE_215 FIRMWARE_209 FIRMWARE_215_DESC= Calculator ROM firmware version 2.15 FIRMWARE_209_DESC= Calculator ROM firmware version 2.09 -OPTIONS_DEFAULT=FIRMWARE_215 +OPTIONS_DEFINE= GRAYSCALE +GRAYSCALE_DESC= Apply patch for grayscale support + +OPTIONS_DEFAULT=FIRMWARE_215 GRAYSCALE SUB_FILES= hp50g.sh @@ -43,6 +46,10 @@ MAKE_ENV+= DEBUGB=1 MAKE_ARGS+=CC="${CC}" +.if ${PORT_OPTIONS:MGRAYSCALE} +EXTRA_PATCHES+= ${FILESDIR}/grayscale.diff +.endif + .if ${PORT_OPTIONS:MFIRMWARE_215H3} || ${PORT_OPTIONS:MFIRMWARE_215} MAKE_ARGS+=FIRMWARE=4950_215.bin DISTFILES+=hp4950v215.zip @@ -70,7 +77,7 @@ do-configure: cd ${WRKSRC}/qemu/qemu-git && ./configure-small --extra-cflags=-DX49GP --cc="${CC}" do-build: - cd ${WRKSRC} && ${MAKE_CMD} ${MAKE_ARGS} + cd ${WRKSRC} && ${SETENV} -u MAKELEVEL -u MAKEFLAGS ${MAKE_CMD} ${MAKE_ARGS} do-install: @${MKDIR} ${STAGEDIR}${DATADIR} diff --git a/emulators/x49gp/files/grayscale.diff b/emulators/x49gp/files/grayscale.diff new file mode 100644 index 000000000000..c207d1d4209f --- /dev/null +++ b/emulators/x49gp/files/grayscale.diff @@ -0,0 +1,203 @@ +Index: include/x49gp_ui.h +=================================================================== +--- include/x49gp_ui.h (revision 11) ++++ include/x49gp_ui.h (working copy) +@@ -15,6 +15,22 @@ + UI_COLOR_SILVER, + UI_COLOR_ORANGE, + UI_COLOR_BLUE, ++ UI_COLOR_GRAYSCALE_0, ++ UI_COLOR_GRAYSCALE_1, ++ UI_COLOR_GRAYSCALE_2, ++ UI_COLOR_GRAYSCALE_3, ++ UI_COLOR_GRAYSCALE_4, ++ UI_COLOR_GRAYSCALE_5, ++ UI_COLOR_GRAYSCALE_6, ++ UI_COLOR_GRAYSCALE_7, ++ UI_COLOR_GRAYSCALE_8, ++ UI_COLOR_GRAYSCALE_9, ++ UI_COLOR_GRAYSCALE_10, ++ UI_COLOR_GRAYSCALE_11, ++ UI_COLOR_GRAYSCALE_12, ++ UI_COLOR_GRAYSCALE_13, ++ UI_COLOR_GRAYSCALE_14, ++ UI_COLOR_GRAYSCALE_15, + UI_COLOR_MAX + } x49gp_ui_color_t; + +Index: s3c2410_lcd.c +=================================================================== +--- s3c2410_lcd.c (revision 11) ++++ s3c2410_lcd.c (working copy) +@@ -94,6 +94,32 @@ + } + } + ++static int ++x49gp_get_pixel_color(s3c2410_lcd_t *lcd, int x, int y) ++{ ++ uint32_t bank, addr, data, offset, pixel_offset; ++ int bits_per_pixel = lcd->lcdcon5 > 2 ? 1 : 4 >> lcd->lcdcon5; ++ ++ bank = (lcd->lcdsaddr1 << 1) & 0x7fc00000; ++ addr = bank | ((lcd->lcdsaddr1 << 1) & 0x003ffffe); ++ ++ pixel_offset = (160 * y + x) * bits_per_pixel; ++ offset = (pixel_offset >> 3) & 0xfffffffc; ++ ++ data = ldl_phys(addr + offset); ++ data >>= pixel_offset & 31; ++ data &= (1 << bits_per_pixel) - 1; ++ ++ switch (bits_per_pixel) { ++ case 1: ++ return 15 * data; ++ case 2: ++ return 15 & (lcd->bluelut >> (2 * data)); ++ default: ++ return data; ++ } ++} ++ + void + x49gp_lcd_update(x49gp_t *x49gp) + { +@@ -100,8 +126,7 @@ + x49gp_ui_t *ui = x49gp->ui; + s3c2410_lcd_t *lcd = x49gp->s3c2410_lcd; + GdkRectangle rect; +- uint32_t bank, addr, offset, data; +- int row, i, b, x, y; ++ int color, x, y; + + if (!(lcd->lcdcon1 & 1)) { + gdk_draw_drawable(ui->lcd_pixmap, ui->window->style->bg_gc[0], +@@ -111,70 +136,45 @@ + goto done; + } + +- bank = (lcd->lcdsaddr1 << 1) & 0x7fc00000; +- addr = bank | ((lcd->lcdsaddr1 << 1) & 0x003ffffe); +- + gdk_draw_drawable(ui->lcd_pixmap, ui->window->style->bg_gc[0], + ui->bg_pixmap, + ui->lcd_x_offset, ui->lcd_y_offset, + 0, 0, ui->lcd_width, ui->lcd_height); + +- data = ldl_phys(addr + 16); +- if (data & (1 << 3)) { +- gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_io_gc, TRUE, +- 236, 0, 15, 12); +- } +- data = ldl_phys(addr + 36); +- if (data & (1 << 3)) { +- gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_left_gc, TRUE, +- 11, 0, 15, 12); +- } +- data = ldl_phys(addr + 56); +- if (data & (1 << 3)) { +- gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_right_gc, TRUE, +- 56, 0, 15, 12); +- } +- data = ldl_phys(addr + 76); +- if (data & (1 << 3)) { +- gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_alpha_gc, TRUE, +- 101, 0, 15, 12); +- } +- data = ldl_phys(addr + 96); +- if (data & (1 << 3)) { +- gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_battery_gc, TRUE, +- 146, 0, 15, 12); +- } +- data = ldl_phys(addr + 116); +- if (data & (1 << 3)) { +- gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_busy_gc, TRUE, +- 191, 0, 15, 12); +- } ++ color = x49gp_get_pixel_color(lcd, 131, 0); ++ gdk_gc_set_rgb_fg_color(ui->ann_io_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_io_gc, TRUE, 236, 0, 15, 12); + +- offset = 0; +- for (row = 0; row < ui->lcd_height / 2; row++) { +- y = 2 * row; +- x = 0; +- for (i = 0; i < 5; i++) { +- data = ldl_phys(addr + offset); +- offset += sizeof(uint32_t); ++ color = x49gp_get_pixel_color(lcd, 131, 1); ++ gdk_gc_set_rgb_fg_color(ui->ann_left_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_left_gc, TRUE, 11, 0, 15, 12); + +- for (b = 0; b < 32; b++) { +- if (data & (1 << b)) { +- gdk_draw_rectangle(ui->lcd_pixmap, +- ui->window->style->fg_gc[0], +- TRUE, x, y + ui->lcd_top_margin, 2, 2); +- } +- x += 2; ++ color = x49gp_get_pixel_color(lcd, 131, 2); ++ gdk_gc_set_rgb_fg_color(ui->ann_right_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_right_gc, TRUE, 56, 0, 15, 12); + +- if (x >= ui->lcd_width) { +- break; +- } +- } ++ color = x49gp_get_pixel_color(lcd, 131, 3); ++ gdk_gc_set_rgb_fg_color(ui->ann_alpha_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_alpha_gc, TRUE, 101, 0, 15, 12); ++ ++ color = x49gp_get_pixel_color(lcd, 131, 4); ++ gdk_gc_set_rgb_fg_color(ui->ann_battery_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_battery_gc, TRUE, 146, 0, 15, 12); ++ ++ color = x49gp_get_pixel_color(lcd, 131, 5); ++ gdk_gc_set_rgb_fg_color(ui->ann_busy_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_busy_gc, TRUE, 191, 0, 15, 12); ++ ++ for (y = 0; y < (ui->lcd_height - ui->lcd_top_margin) / 2; y++) { ++ for (x = 0; x < ui->lcd_width / 2; x++) { ++ color = x49gp_get_pixel_color(lcd, x, y); ++ gdk_gc_set_rgb_fg_color(ui->window->style->fg_gc[0], ++ &(ui->colors[UI_COLOR_GRAYSCALE_0 + color])); ++ gdk_draw_rectangle(ui->lcd_pixmap, ui->window->style->fg_gc[0], TRUE, ++ 2 * x, 2 * y + ui->lcd_top_margin, 2, 2); + } + } + +- addr = bank | ((lcd->lcdsaddr2 << 1) & 0x003ffffe); +- + done: + rect.x = 0; + rect.y = 0; +Index: ui.c +=================================================================== +--- ui.c (revision 11) ++++ ui.c (working copy) +@@ -2285,7 +2285,24 @@ + x49gp_ui_color_init(&ui->colors[UI_COLOR_ORANGE], 0xc0, 0x6e, 0x60); + x49gp_ui_color_init(&ui->colors[UI_COLOR_BLUE], 0x40, 0x60, 0xa4); + ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_0], 0xab, 0xd2, 0xb4); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_1], 0xa0, 0xc4, 0xa8); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_2], 0x94, 0xb6, 0x9c); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_3], 0x89, 0xa8, 0x90); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_4], 0x7d, 0x9a, 0x84); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_5], 0x72, 0x8c, 0x78); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_6], 0x67, 0x7e, 0x6c); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_7], 0x5b, 0x70, 0x60); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_8], 0x50, 0x62, 0x54); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_9], 0x44, 0x54, 0x48); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_10], 0x39, 0x46, 0x3c); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_11], 0x2e, 0x38, 0x30); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_12], 0x22, 0x2a, 0x24); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_13], 0x17, 0x1c, 0x18); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_14], 0x0b, 0x03, 0x0c); ++ x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_15], 0x00, 0x00, 0x00); + ++ + ui->lcd_canvas = gtk_drawing_area_new(); + gtk_drawing_area_size(GTK_DRAWING_AREA(ui->lcd_canvas), + ui->lcd_width, ui->lcd_height); + |