Numerous Linux updates:

- OpenGL : fixed texture size to be exclusively a power of 2
- OpenGL : Clear the screen on init
- OpenGL : Set fullscreen resolution to the resolution of the desktop
- Changed the executable name to vbam to avoid conflict with the original VBA
- Added a basic install target to the makefile
- Fixed .gz archives loading when using fex_mini (thanks to tttttttttanaka)
- Added debian packaging informations
This commit is contained in:
mudlord 2008-01-17 04:51:34 +00:00
parent 4fddbeaff1
commit 95c798e5d3
10 changed files with 201 additions and 57 deletions

View File

@ -1,7 +1,7 @@
MACHINE= $(shell uname -s)
CC=gcc
CPPC=g++
CFLAGS=-W -Wall -Wno-unused -O3 -DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DFINAL_VERSION -DBKPT_SUPPORT -DSDL -DSYSCONFDIR="home" -DUSE_OPENGL -DC_CORE
CFLAGS=-W -Wall -Wno-unused -O3 -DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DBKPT_SUPPORT -DSDL -DSYSCONFDIR="home" -DUSE_OPENGL -DC_CORE
CXXFLAGS=${CFLAGS}
ASM=nasm
ASMFLAGS=-w-orphan-labels -f elf -DELF -O1 -Isrc/hq/asm/
@ -9,7 +9,7 @@ LFLAGS=-lz -lpng -lGL `sdl-config --libs`
STRIP=strip -s
DEL=rm -f
OE=.o
OUT=vba
OUT=vbam
ifeq ($(MACHINE),Darwin)
LFLAGS=-lz -lpng -framework OpenGL `sdl-config --libs`
@ -20,7 +20,7 @@ ifeq ($(PLATFORM),win)
LFLAGS=-lz -lpng -lSDL -lwsock32 -lopengl32
DELETECOMMAND = del
OE=.obj
OUT=vba.exe
OUT=vbam.exe
endif
ifeq ($(PLATFORM),win-cross)
@ -30,7 +30,11 @@ ifeq ($(PLATFORM),win-cross)
LFLAGS=-lz -lpng -lSDL -lwsock32 -lopengl32
STRIP=i586-mingw32-strip -s
OE=.obj
OUT=vba.exe
OUT=vbam.exe
endif
ifndef $(PREFIX)
PREFIX=/usr/local
endif
MAINDIR=src
@ -102,4 +106,8 @@ ${OUT}: ${OBJECTS}
$(STRIP) $@
clean:
$(DEL) ${OUT} ${OBJECTS}
$(DEL) ${OUT} ${OBJECTS}
install: ${OUT}
install -d $(DESTDIR)$(PREFIX)/bin
install ./${OUT} $(DESTDIR)$(PREFIX)/bin

6
debian/changelog vendored Normal file
View File

@ -0,0 +1,6 @@
vbam (0.svn307-1) unstable; urgency=low
* Initial release
-- Bastien Bouclet <bgkweb@gmail.com> Tue, 15 Jan 2008 13:31:45 +0100

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
5

13
debian/control vendored Normal file
View File

@ -0,0 +1,13 @@
Source: vbam
Section: games
Priority: extra
Maintainer: Bastien Bouclet <bgkweb@gmail.com>
Build-Depends: debhelper (>= 5), zlib1g-dev, libpng12-dev, libsdl1.2-dev, libgl1-mesa-dev
Standards-Version: 3.7.2
Package: vbam
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Nintendo GameBoy Advance emulator
VBA-M is a Nintendo GameBoy Advance emulator. It runs homebrew and commercial games.
This version is based on the SDL library.

23
debian/copyright vendored Normal file
View File

@ -0,0 +1,23 @@
This package was debianized by Bastien Bouclet <bgkweb@gmail.com> on
Tue, 15 Jan 2008 13:31:45 +0100.
It was downloaded from https://vbam.bountysource.com/
Copyright:
Copyright (C) 1999-2003 Forgotten
Copyright (C) 2004-2006 VBA development team
Copyright (C) 2007-2008 VBA-M development team
License:
VBA-M is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
On Debian systems, the complete text of the GNU General Public License
can be found in the '/usr/share/common-licenses/GPL' file.
The Debian packaging is (C) 2008, Bastien Bouclet <bgkweb@gmail.com> and
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.

2
debian/dirs vendored Normal file
View File

@ -0,0 +1,2 @@
usr/bin
usr/sbin

1
debian/docs vendored Normal file
View File

@ -0,0 +1 @@
doc/*

90
debian/rules vendored Normal file
View File

@ -0,0 +1,90 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
build: build-stamp
build-stamp:
dh_testdir
# No ASM optimized version since it is i386 specific
$(MAKE)
#docbook-to-man debian/vbam.sgml > vbam.1
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/vbam.
$(MAKE) PREFIX=/usr DESTDIR=$(CURDIR)/debian/vbam install
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

View File

@ -20,7 +20,7 @@
#ifndef __AUTOBUILD_H__
#define __AUTOBUILD_H__
#ifndef VERSION
#define VERSION "1.8.0"
#define VERSION "1.8.0-SVN"
#endif
//change the FALSE to TRUE for autoincrement of build number
#define INCREMENT_VERSION FALSE

View File

@ -22,6 +22,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <cmath>
#ifdef __APPLE__
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>
@ -120,6 +121,8 @@ int srcWidth = 0;
int srcHeight = 0;
int destWidth = 0;
int destHeight = 0;
int desktopWidth = 0;
int desktopHeight = 0;
int sensorX = 2047;
int sensorY = 2047;
@ -147,12 +150,13 @@ int RGB_LOW_BITS_MASK=0x821;
u32 systemColorMap32[0x10000];
u16 systemColorMap16[0x10000];
u16 systemGbPalette[24];
void (*filterFunction)(u8*,u32,u8*,u8*,u32,int,int) = NULL;
FilterFunc filterFunction = NULL;
void (*ifbFunction)(u8*,u32,int,int) = NULL;
int ifbType = 0;
char filename[2048];
char ipsname[2048];
char biosFileName[2048];
char gbBiosFileName[2048];
char captureDir[2048];
char saveDir[2048];
char batteryDir[2048];
@ -412,11 +416,11 @@ FILE *sdlFindFile(const char *name)
#ifdef _WIN32
#define PATH_SEP ";"
#define FILE_SEP '\\'
#define EXE_NAME "VisualBoyAdvance-SDL.exe"
#define EXE_NAME "vbam.exe"
#else // ! _WIN32
#define PATH_SEP ":"
#define FILE_SEP '/'
#define EXE_NAME "VisualBoyAdvance"
#define EXE_NAME "vbam"
#endif // ! _WIN32
fprintf(stderr, "Searching for file %s\n", name);
@ -652,6 +656,8 @@ void sdlReadPreferences(FILE *f)
skipBios = sdlFromHex(value) ? true : false;
} else if(!strcmp(key, "biosFile")) {
strcpy(biosFileName, value);
} else if(!strcmp(key, "gbBiosFile")) {
strcpy(gbBiosFileName, value);
} else if(!strcmp(key, "filter")) {
filter = sdlFromHex(value);
if(filter < 0 || filter > 17)
@ -790,9 +796,22 @@ void sdlOpenGLInit(int w, int h)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
openGL == 2 ? GL_LINEAR : GL_NEAREST);
textureSize = 256 * filter_enlarge;
// Calculate texture size as a the smallest working power of two
float n1 = log10((float)destWidth ) / log10( 2.0f);
float n2 = log10((float)destHeight ) / log10( 2.0f);
float n = (n1 > n2)? n1 : n2;
// round up
if (((float)((int)n)) != n)
n = ((float)((int)n)) + 1.0f;
textureSize = (int)pow(2.0f, n);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureSize, textureSize, 0,
GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glClearColor(0.0,0.0,0.0,1.0);
glClear( GL_COLOR_BUFFER_BIT );
}
void sdlReadPreferences()
@ -998,8 +1017,16 @@ void sdlReadBattery()
systemScreenMessage("Loaded battery");
}
void sdlReadDesktopVideoMode() {
const SDL_VideoInfo* vInfo = SDL_GetVideoInfo();
desktopWidth = vInfo->current_w;
desktopHeight = vInfo->current_h;
}
void sdlInitVideo() {
int flags;
int screenWidth;
int screenHeight;
filter_enlarge = getFilterEnlargeFactor((Filter)filter);
destWidth = filter_enlarge * srcWidth;
@ -1012,7 +1039,15 @@ void sdlInitVideo() {
} else
flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
surface = SDL_SetVideoMode(destWidth, destHeight, 0, flags);
if (fullscreen && openGL) {
screenWidth = desktopWidth;
screenHeight = desktopHeight;
} else {
screenWidth = destWidth;
screenHeight = destHeight;
}
surface = SDL_SetVideoMode(screenWidth, screenHeight, 0, flags);
if(surface == NULL) {
systemMessage(0, "Failed to set video mode");
@ -1020,12 +1055,6 @@ void sdlInitVideo() {
exit(-1);
}
if(openGL) {
free(filterPix);
filterPix = (u8 *)calloc(1, 4 * destWidth * destHeight);
sdlOpenGLInit(destWidth, destHeight);
}
systemRedShift = sdlCalculateShift(surface->format->Rmask);
systemGreenShift = sdlCalculateShift(surface->format->Gmask);
systemBlueShift = sdlCalculateShift(surface->format->Bmask);
@ -1040,6 +1069,13 @@ void sdlInitVideo() {
else
srcPitch = srcWidth*3;
}
if(openGL) {
free(filterPix);
filterPix = (u8 *)calloc(1, (systemColorDepth >> 3) * destWidth * destHeight);
sdlOpenGLInit(screenWidth, screenHeight);
}
}
#define MOD_KEYS (KMOD_CTRL|KMOD_SHIFT|KMOD_ALT|KMOD_META)
@ -1573,7 +1609,7 @@ Long options only:\n\
int main(int argc, char **argv)
{
fprintf(stderr, "VisualBoyAdvance version %s [SDL]\n", VERSION);
fprintf(stderr, "VBA-M version %s [SDL]\n", VERSION);
arg0 = argv[0];
@ -1821,16 +1857,7 @@ int main(int argc, char **argv)
// used for the handling of the gb Boot Rom
if (gbHardware & 5)
{
char tempName[0x800];
strcpy(tempName, arg0);
char *p = strrchr(tempName, '\\');
if(p) { *p = 0x00; }
strcat(tempName, "\\DMG_ROM.bin");
fprintf(stderr, "%s\n", tempName);
gbCPUInit(tempName, useBios);
}
else useBios = false;
gbCPUInit(gbBiosFileName, useBios);
gbReset();
cartridgeType = IMAGE_GB;
@ -1937,6 +1964,8 @@ int main(int argc, char **argv)
srcHeight = 240;
}
sdlReadDesktopVideoMode();
sdlInitVideo();
filterFunction = initFilter((Filter)filter, systemColorDepth, srcWidth);
@ -2565,7 +2594,6 @@ bool systemPauseOnFrame()
void systemGbBorderOn()
{
long flags;
srcWidth = 256;
srcHeight = 224;
gbBorderLineSkip = 256;
@ -2575,32 +2603,4 @@ void systemGbBorderOn()
sdlInitVideo();
filterFunction = initFilter((Filter)filter, systemColorDepth, srcWidth);
if(systemColorDepth == 16) {
if(sdlCalculateMaskWidth(surface->format->Gmask) == 6) {
RGB_LOW_BITS_MASK = 0x821;
} else {
RGB_LOW_BITS_MASK = 0x421;
}
if(cartridgeType == 2) {
for(int i = 0; i < 0x10000; i++) {
systemColorMap16[i] = (((i >> 1) & 0x1f) << systemBlueShift) |
(((i & 0x7c0) >> 6) << systemGreenShift) |
(((i & 0xf800) >> 11) << systemRedShift);
}
} else {
for(int i = 0; i < 0x10000; i++) {
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
}
} else {
RGB_LOW_BITS_MASK = 0x010101;
for(int i = 0; i < 0x10000; i++) {
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
}
}