mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2024-12-22 16:05:33 +02:00
liballegro: fix demo and setup programs for 32bpp video mode; move data-files
to /usr/share; add a liballegro-data package
This commit is contained in:
parent
c3be89f4a8
commit
77f424bc39
@ -31,7 +31,7 @@ PKG_INSTALL:=1
|
||||
PKG_FIXUP:=libtool
|
||||
PKG_REMOVE_FILES:=
|
||||
|
||||
PKG_BUILD_DEPENDS:=liballegro/host
|
||||
# PKG_BUILD_DEPENDS:=liballegro/host
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@ -231,24 +231,26 @@ define Package/liballegro/install
|
||||
endef
|
||||
|
||||
define Package/liballegro-data/install
|
||||
$(INSTALL_DIR) $(1)/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/share $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/share/allegro
|
||||
$(INSTALL_DIR) $(1)/usr/share/allegro/docs/txt
|
||||
$(CP) $(PKG_BUILD_DIR)/{keyboard.dat,language.dat} $(1)/usr/share/allegro
|
||||
# readme file is used by the allegro 'shooter' demo
|
||||
$(CP) $(PKG_BUILD_DIR)/docs/txt/readme.txt $(1)/usr/share/allegro/docs/txt
|
||||
endef
|
||||
|
||||
define Package/liballegro-demo/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/share/allegro/shooter
|
||||
$(INSTALL_DIR) $(1)/usr/share/allegro/skater
|
||||
$(INSTALL_DIR) $(1)/usr/share/allegro
|
||||
$(CP) $(PKG_BUILD_DIR)/demos/shooter/shooter $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/demos/shooter/demo.dat $(1)/usr/share/allegro/shooter/
|
||||
$(CP) $(PKG_BUILD_DIR)/demos/shooter/demo.dat $(1)/usr/share/allegro/shooter.dat
|
||||
$(CP) $(PKG_BUILD_DIR)/demos/skater/skater $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/demos/skater/demo.dat $(1)/usr/share/allegro/skater/
|
||||
$(CP) $(PKG_BUILD_DIR)/demos/skater/demo.dat $(1)/usr/share/allegro/skater.dat
|
||||
endef
|
||||
|
||||
define Package/liballegro-setup/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/share/allegro/
|
||||
$(CP) $(PKG_BUILD_DIR)/setup/setup $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/setup/setup $(1)/usr/bin/allegro-setup
|
||||
$(CP) $(PKG_BUILD_DIR)/setup/setup.dat $(1)/usr/share/allegro/
|
||||
endef
|
||||
|
||||
@ -267,7 +269,7 @@ endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,liballegro))
|
||||
#$(eval $(call BuildPackage,liballegro-data))
|
||||
$(eval $(call BuildPackage,liballegro-data))
|
||||
$(eval $(call BuildPackage,liballegro-demo))
|
||||
$(eval $(call BuildPackage,liballegro-setup))
|
||||
$(eval $(call BuildPackage,liballegro-examples))
|
||||
|
@ -1,23 +0,0 @@
|
||||
Index: allegro-4.4.2/demos/shooter/demo.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-05-29 12:56:58.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/demo.c 2011-05-31 15:57:29.000000000 +0200
|
||||
@@ -1,3 +1,5 @@
|
||||
+#define DEBUGMODE
|
||||
+
|
||||
#include "demo.h"
|
||||
#include "data.h"
|
||||
#include "expl.h"
|
||||
@@ -90,9 +92,9 @@
|
||||
allegro_message("Error initialising joystick\n%s\n", allegro_error);
|
||||
install_joystick(JOY_TYPE_NONE);
|
||||
}
|
||||
-
|
||||
- if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
|
||||
- if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
|
||||
+ /* set_color_depth(32); */
|
||||
+ if (set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0) != 0) {
|
||||
+ if (set_gfx_mode(GFX_SAFE, 320, 240, 0, 0) != 0) {
|
||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||
allegro_message("Unable to set any graphic mode\n%s\n",
|
||||
allegro_error);
|
@ -1,7 +1,7 @@
|
||||
Index: allegro-4.4.2/src/linux/fbcon.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/src/linux/fbcon.c 2011-05-31 15:57:15.000000000 +0200
|
||||
+++ allegro-4.4.2/src/linux/fbcon.c 2011-05-31 17:04:32.000000000 +0200
|
||||
--- allegro-4.4.2.orig/src/linux/fbcon.c 2011-06-01 18:29:11.000000000 +0200
|
||||
+++ allegro-4.4.2/src/linux/fbcon.c 2011-06-02 11:04:18.000000000 +0200
|
||||
@@ -19,6 +19,10 @@
|
||||
* See readme.txt for copyright information.
|
||||
*/
|
||||
|
74
liballegro/patches/030-move-dat-files.patch
Normal file
74
liballegro/patches/030-move-dat-files.patch
Normal file
@ -0,0 +1,74 @@
|
||||
Index: allegro-4.4.2/demos/shooter/demo.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-02 11:18:39.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-02 11:20:02.000000000 +0200
|
||||
@@ -103,7 +103,7 @@
|
||||
get_executable_name(buf, sizeof(buf));
|
||||
replace_filename(buf2, buf, "demo.dat", sizeof(buf2));
|
||||
set_color_conversion(COLORCONV_NONE);
|
||||
- data = load_datafile(buf2);
|
||||
+ data = load_datafile("/usr/share/allegro/shooter.dat" /*buf2*/);
|
||||
if (!data) {
|
||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||
allegro_message("Error loading %s\n", buf2);
|
||||
Index: allegro-4.4.2/demos/skater/source/framewk.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/skater/source/framewk.c 2011-06-02 11:19:00.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/skater/source/framewk.c 2011-06-02 11:26:44.000000000 +0200
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
/* name of the configuration file for storing demo-specific settings. */
|
||||
-#define DEMO_CFG "demo.cfg"
|
||||
+#define DEMO_CFG "skater.cfg"
|
||||
|
||||
/*
|
||||
Timer callback. Installed with the frequency defined in the framework
|
||||
@@ -84,11 +84,13 @@
|
||||
|
||||
/* Construct aboslute path for the configuration file. */
|
||||
get_executable_name(config_path, DEMO_PATH_LENGTH);
|
||||
+ strcpy(config_path, "/etc/allegro/dummy");
|
||||
replace_filename(config_path, config_path, DEMO_CFG, DEMO_PATH_LENGTH);
|
||||
|
||||
/* Construct aboslute path for the datafile containing game menu data. */
|
||||
get_executable_name(data_path, DEMO_PATH_LENGTH);
|
||||
- replace_filename(data_path, data_path, "demo.dat#menu.dat",
|
||||
+ strcpy(data_path, "/usr/share/allegro/dummy");
|
||||
+ replace_filename(data_path, data_path, "skater.dat#menu.dat",
|
||||
DEMO_PATH_LENGTH);
|
||||
|
||||
/* Read configuration file. */
|
||||
Index: allegro-4.4.2/demos/skater/source/game_sk.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/skater/source/game_sk.c 2011-06-02 11:20:54.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/skater/source/game_sk.c 2011-06-02 11:26:38.000000000 +0200
|
||||
@@ -70,10 +70,10 @@
|
||||
char *load_game_resources(void)
|
||||
{
|
||||
int c;
|
||||
- char AudioPath[DEMO_PATH_LENGTH];
|
||||
+ char AudioPath[DEMO_PATH_LENGTH] = "/usr/share/allegro/dummy";
|
||||
|
||||
- get_executable_name(AudioPath, DEMO_PATH_LENGTH);
|
||||
- replace_filename(AudioPath, AudioPath, "demo.dat#audio.dat",
|
||||
+ /* get_executable_name(AudioPath, DEMO_PATH_LENGTH); */
|
||||
+ replace_filename(AudioPath, AudioPath, "skater.dat#audio.dat",
|
||||
DEMO_PATH_LENGTH);
|
||||
game_audio = load_datafile(AudioPath);
|
||||
|
||||
Index: allegro-4.4.2/demos/skater/source/level.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/skater/source/level.c 2011-06-02 11:22:02.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/skater/source/level.c 2011-06-02 11:26:49.000000000 +0200
|
||||
@@ -74,8 +74,9 @@
|
||||
#endif
|
||||
char LocName[DEMO_PATH_LENGTH], TString[DEMO_PATH_LENGTH];
|
||||
|
||||
- uszprintf(TString, sizeof(TString), "demo.dat#%s", name);
|
||||
+ uszprintf(TString, sizeof(TString), "skater.dat#%s", name);
|
||||
get_executable_name(LocName, DEMO_PATH_LENGTH);
|
||||
+ strcpy(LocName, "/usr/share/allegro/dummy");
|
||||
replace_filename(LocName, LocName, TString, DEMO_PATH_LENGTH);
|
||||
|
||||
#ifdef DEMO_USE_ALLEGRO_GL
|
45
liballegro/patches/040-setup-gfx-mode.patch
Normal file
45
liballegro/patches/040-setup-gfx-mode.patch
Normal file
@ -0,0 +1,45 @@
|
||||
Index: allegro-4.4.2/setup/keyconf.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/setup/keyconf.c 2011-06-02 11:49:16.000000000 +0200
|
||||
+++ allegro-4.4.2/setup/keyconf.c 2011-06-02 11:49:47.000000000 +0200
|
||||
@@ -361,6 +361,10 @@
|
||||
bg = 16;
|
||||
mg = 8;
|
||||
}
|
||||
+
|
||||
+ bg = palette_color[bg];
|
||||
+ fg = palette_color[fg];
|
||||
+ mg = palette_color[mg];
|
||||
|
||||
rectfill(screen, d->x+1, d->y+1, d->x+d->w-1, d->y+d->h-1, bg);
|
||||
rect(screen, d->x, d->y, d->x+d->w, d->y+d->h, fg);
|
||||
@@ -401,6 +405,9 @@
|
||||
bg = (d->d1 == codepage) ? 1 : 8;
|
||||
}
|
||||
|
||||
+ bg = palette_color[bg];
|
||||
+ fg = palette_color[fg];
|
||||
+
|
||||
rectfill(screen, d->x+1, d->y+1, d->x+d->w-1, d->y+d->h-1, bg);
|
||||
rect(screen, d->x, d->y, d->x+d->w, d->y+d->h, 255);
|
||||
|
||||
Index: allegro-4.4.2/setup/setup.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/setup/setup.c 2011-06-02 11:37:51.000000000 +0200
|
||||
+++ allegro-4.4.2/setup/setup.c 2011-06-02 11:38:38.000000000 +0200
|
||||
@@ -2851,12 +2851,14 @@
|
||||
install_keyboard();
|
||||
install_timer();
|
||||
|
||||
- fade_out(4);
|
||||
+ /* fade_out(4); */
|
||||
+ set_color_depth(32);
|
||||
if (set_gfx_mode(GFX_AUTODETECT, SETUP_SCREEN_W, SETUP_SCREEN_H, 0, 0) != 0) {
|
||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||
allegro_message(uconvert_ascii("Unable to set graphic mode\n%s\n", tmp1), allegro_error);
|
||||
return 1;
|
||||
}
|
||||
+ set_color_depth(8);
|
||||
#endif
|
||||
|
||||
set_palette(black_palette);
|
110
liballegro/patches/050-shooter-gfx-mode.patch
Normal file
110
liballegro/patches/050-shooter-gfx-mode.patch
Normal file
@ -0,0 +1,110 @@
|
||||
Index: allegro-4.4.2/demos/shooter/demo.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-01 20:05:58.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-01 20:06:18.000000000 +0200
|
||||
@@ -1,3 +1,5 @@
|
||||
+#define DEBUGMODE
|
||||
+
|
||||
#include "demo.h"
|
||||
#include "data.h"
|
||||
#include "expl.h"
|
||||
@@ -90,7 +92,6 @@
|
||||
allegro_message("Error initialising joystick\n%s\n", allegro_error);
|
||||
install_joystick(JOY_TYPE_NONE);
|
||||
}
|
||||
-
|
||||
if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
|
||||
if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
|
||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||
Index: allegro-4.4.2/demos/shooter/display.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/display.c 2011-06-01 20:05:59.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/display.c 2011-06-01 20:06:18.000000000 +0200
|
||||
@@ -28,18 +28,19 @@
|
||||
break;
|
||||
}
|
||||
|
||||
- set_color_depth(8);
|
||||
+ set_color_depth(32);
|
||||
#ifdef ALLEGRO_VRAM_SINGLE_SURFACE
|
||||
if (set_gfx_mode(mode, w, h, w, h * num_pages) != 0) {
|
||||
#else
|
||||
if (set_gfx_mode(mode, w, h, 0, 0) != 0) {
|
||||
#endif
|
||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||
- allegro_message("Error setting 8bpp graphics mode\n%s\n",
|
||||
+ allegro_message("Error setting 32bpp graphics mode\n%s\n",
|
||||
allegro_error);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+ set_color_depth(8);
|
||||
page1 = NULL;
|
||||
page2 = NULL;
|
||||
page3 = NULL;
|
||||
@@ -49,7 +50,7 @@
|
||||
|
||||
case DOUBLE_BUFFER:
|
||||
case DIRTY_RECTANGLE:
|
||||
- memory_buffer = create_bitmap(SCREEN_W, SCREEN_H);
|
||||
+ memory_buffer = create_bitmap_ex(8, SCREEN_W, SCREEN_H);
|
||||
|
||||
if (!memory_buffer) {
|
||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||
Index: allegro-4.4.2/demos/shooter/game.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/game.c 2011-06-01 20:05:59.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/game.c 2011-06-01 20:37:13.000000000 +0200
|
||||
@@ -58,12 +58,18 @@
|
||||
static void draw_intro_item(int item, int size)
|
||||
{
|
||||
BITMAP *b = (BITMAP *) data[item].dat;
|
||||
+ BITMAP *b_n = create_bitmap_ex(32, b->w, b->h);
|
||||
+ clear_to_color(b_n,0xffff);
|
||||
+ set_palette(data[GAME_PAL].dat);
|
||||
+ blit (b, b_n, 0, 0, 0, 0, b->w, b->h);
|
||||
+
|
||||
int w = MIN(SCREEN_W, (SCREEN_W * 2 / size));
|
||||
int h = SCREEN_H / size;
|
||||
|
||||
clear_bitmap(screen);
|
||||
- stretch_blit(b, screen, 0, 0, b->w, b->h, (SCREEN_W - w) / 2,
|
||||
+ stretch_blit(b_n, screen, 0, 0, b->w, b->h, (SCREEN_W - w) / 2,
|
||||
(SCREEN_H - h) / 2, w, h);
|
||||
+ destroy_bitmap(b_n);
|
||||
}
|
||||
|
||||
|
||||
Index: allegro-4.4.2/demos/shooter/title.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/title.c 2011-06-01 20:05:58.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/title.c 2011-06-01 20:06:18.000000000 +0200
|
||||
@@ -843,10 +843,11 @@
|
||||
scroll_count = 1;
|
||||
install_int(scroll_counter, 5);
|
||||
|
||||
- while ((c = scroll_count) < 160)
|
||||
- stretch_blit(data[TITLE_BMP].dat, screen, 0, 0, 320, 128,
|
||||
- SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32,
|
||||
- c * 2, c * 128 / 160);
|
||||
+ /* todo: stretch_blit won't work over color depth */
|
||||
+ /* while ((c = scroll_count) < 160) */
|
||||
+ /* stretch_blit(data[TITLE_BMP].dat, screen, 0, 0, 320, 128, */
|
||||
+ /* SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32, */
|
||||
+ /* c * 2, c * 128 / 160); */
|
||||
|
||||
remove_int(scroll_counter);
|
||||
|
||||
Index: allegro-4.4.2/demos/shooter/dirty.c
|
||||
===================================================================
|
||||
--- allegro-4.4.2.orig/demos/shooter/dirty.c 2011-06-01 20:11:58.000000000 +0200
|
||||
+++ allegro-4.4.2/demos/shooter/dirty.c 2011-06-01 20:12:08.000000000 +0200
|
||||
@@ -93,7 +93,7 @@
|
||||
acquire_screen();
|
||||
|
||||
for (c = 0; c < old_dirty.count; c++) {
|
||||
- if ((old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
|
||||
+ if (0 && (old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
|
||||
putpixel(screen, old_dirty.rect[c].x, old_dirty.rect[c].y,
|
||||
getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y));
|
||||
}
|
Loading…
Reference in New Issue
Block a user