Bug#1038520: noiz2sa: Depends on SDL 1.2
Patrice Duroux
patrice.duroux at gmail.com
Sat Nov 9 20:47:07 GMT 2024
Source: noiz2sa
Version: 0.51a-13
Followup-For: Bug #1038520
X-Debbugs-Cc: debian-devel-games at lists.debian.org
Hi,
Here's a fix to help update its packaging and it should close at least #1038520
and #1045358.
A few points:
- The current Debian VCS repository[1] does not match the structure of the
upstream source zip downloaded here[2]. A reason for this?
- The SDL2 port comes from [3] but its repository seems broken to me concerning
binary files (in images, ogg and sounds).
- The build will no longer use the internal copy of bulletml but libbulletml-
dev. And so it doesn't need libboost-dev and bison. A d/patch address bulletml,
I didn't delete it. I could be in this context.
Greetings,
Patrice
[1] https://salsa.debian.org/games-team/noiz2sa
[2] https://www.asahi-net.or.jp/~cs8k-cyu/windows/noiz2sa_e.html
[3] https://github.com/IoriBranford/noiz2sdl2
-- System Information:
Debian Release: trixie/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.11.6-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff --git a/debian/changelog b/debian/changelog
index 5ee77ba..10a5ca5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+noiz2sa (0.51a-13.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Add patch to use SDL2. (Closes: #1038520)
+ * Build using libbulletml-dev in place of inner copy. (Closes: #1045358)
+
+ -- Patrice Duroux <patrice.duroux at gmail.com> Sat, 09 Nov 2024 21:09:41 +0100
+
noiz2sa (0.51a-13) unstable; urgency=medium
* Add noiz2sa.maintscript: Handle symlink to directory conversion.
diff --git a/debian/control b/debian/control
index ccc470d..279323d 100644
--- a/debian/control
+++ b/debian/control
@@ -5,12 +5,12 @@ Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
Uploaders:
Markus Koschany <apo at debian.org>
Build-Depends:
- bison,
debhelper-compat (= 13),
- libboost-dev,
- libsdl-mixer1.2-dev,
- libsdl1.2-dev
-Standards-Version: 4.6.0
+ libbulletml-dev,
+ libsdl2-mixer-dev,
+ libsdl2-dev
+Standards-Version: 4.7.0
+Rules-Requires-Root: no
Homepage: http://www.asahi-net.or.jp/~cs8k-cyu/windows/noiz2sa_e.html
Vcs-Git: https://salsa.debian.org/games-team/noiz2sa.git
Vcs-Browser: https://salsa.debian.org/games-team/noiz2sa
diff --git a/debian/patches/build.patch b/debian/patches/build.patch
index 0703664..b2221ad 100644
--- a/debian/patches/build.patch
+++ b/debian/patches/build.patch
@@ -28,9 +28,10 @@ index 1bc9344..d533473 100644
-PROG = $(NAME).exe
+PROG = $(NAME)
- DEFAULT_CFLAGS = `sdl-config --cflags`
+-DEFAULT_CFLAGS = `sdl-config --cflags`
-LDFLAGS = `sdl-config --libs` -L. -lmingw32 -lmingwex -lSDL_mixer -lbulletml -mwindows -lstdc++
-+LDFLAGS = `sdl-config --libs` -lSDL_mixer -Lbulletml \
++DEFAULT_CFLAGS = `sdl2-config --cflags`
++LDFLAGS = `sdl2-config --libs` -lSDL2_mixer -lbulletml \
+ -lbulletml -lstdc++ -lm
-MORE_CFLAGS = -O3
diff --git a/debian/patches/bulletml.patch b/debian/patches/bulletml.patch
new file mode 100644
index 0000000..b34ffb3
--- /dev/null
+++ b/debian/patches/bulletml.patch
@@ -0,0 +1,51 @@
+diff --git a/src/foe.h b/src/foe.h
+index 567a88f..1edba64 100644
+--- a/src/foe.h
++++ b/src/foe.h
+@@ -12,9 +12,9 @@
+ #ifndef FOE_H_
+ #define FOE_H_
+
+-#include "bulletml/bulletmlparser.h"
+-#include "bulletml/bulletmlparser-tinyxml.h"
+-#include "bulletml/bulletmlrunner.h"
++#include <bulletml/bulletmlparser.h>
++#include <bulletml/bulletmlparser-tinyxml.h>
++#include <bulletml/bulletmlrunner.h>
+ #include "foecommand.h"
+ #include "barragemanager.h"
+
+diff --git a/src/foecommand.cc b/src/foecommand.cc
+index 847d410..2427593 100644
+--- a/src/foecommand.cc
++++ b/src/foecommand.cc
+@@ -9,9 +9,9 @@
+ *
+ * @version $Revision: 1.2 $
+ */
+-#include "bulletml/bulletmlparser.h"
+-#include "bulletml/bulletmlparser-tinyxml.h"
+-#include "bulletml/bulletmlrunner.h"
++#include <bulletml/bulletmlparser.h>
++#include <bulletml/bulletmlparser-tinyxml.h>
++#include <bulletml/bulletmlrunner.h>
+ #include "foe.h"
+
+ extern "C" {
+diff --git a/src/foecommand.h b/src/foecommand.h
+index 61c8b97..5869b54 100644
+--- a/src/foecommand.h
++++ b/src/foecommand.h
+@@ -12,9 +12,9 @@
+ #ifndef FOECOMMAND_H_
+ #define FOECOMMAND_H_
+
+-#include "bulletml/bulletmlparser.h"
+-#include "bulletml/bulletmlparser-tinyxml.h"
+-#include "bulletml/bulletmlrunner.h"
++#include <bulletml/bulletmlparser.h>
++#include <bulletml/bulletmlparser-tinyxml.h>
++#include <bulletml/bulletmlrunner.h>
+ #include "foe.h"
+
+ class FoeCommand : public BulletMLRunner {
diff --git a/debian/patches/sdl2.patch b/debian/patches/sdl2.patch
new file mode 100644
index 0000000..50b01de
--- /dev/null
+++ b/debian/patches/sdl2.patch
@@ -0,0 +1,283 @@
+diff --git a/src/noiz2sa.c b/src/noiz2sa.c
+index 1fde242..0130c07 100644
+--- a/src/noiz2sa.c
++++ b/src/noiz2sa.c
+@@ -236,6 +236,10 @@ static void parseArgs(int argc, char *argv[]) {
+ noSound = 1;
+ } else if ( strcmp(argv[i], "-window") == 0 ) {
+ windowMode = 1;
++ } else if ( strcmp(argv[i], "-scalelinear") == 0 ) {
++ scaleLinear = 1;
++ } else if ( strcmp(argv[i], "-scaleinteger") == 0 ) {
++ scaleInteger = 1;
+ } else if ( strcmp(argv[i], "-reverse") == 0 ) {
+ buttonReversed = 1;
+ } else if ( (strcmp(argv[i], "-brightness") == 0) && argv[i+1] ) {
+@@ -271,16 +275,16 @@ int main(int argc, char *argv[]) {
+ parseArgs(argc, argv);
+
+ initDegutil();
+- initSDL(windowMode);
++ initSDL(windowMode, scaleLinear, scaleInteger);
+ if ( !noSound ) initSound();
+ initFirst();
+ initTitle();
+
+ while ( !done ) {
+ SDL_PollEvent(&event);
+- keys = SDL_GetKeyState(NULL);
+- if ( keys[SDLK_ESCAPE] == SDL_PRESSED || event.type == SDL_QUIT ) done = 1;
+- if ( keys[SDLK_p] == SDL_PRESSED ) {
++ keys = SDL_GetKeyboardState(NULL);
++ if ( keys[SDL_SCANCODE_ESCAPE] == SDL_PRESSED || event.type == SDL_QUIT ) done = 1;
++ if ( keys[SDL_SCANCODE_P] == SDL_PRESSED ) {
+ if ( !pPrsd ) {
+ if ( status == IN_GAME ) {
+ status = PAUSE;
+@@ -318,4 +322,5 @@ int main(int argc, char *argv[]) {
+ flipScreen();
+ }
+ quitLast();
++ return 0;
+ }
+diff --git a/src/screen.c b/src/screen.c
+index d57938f..f51d761 100644
+--- a/src/screen.c
++++ b/src/screen.c
+@@ -24,9 +24,14 @@
+ #include "attractmanager.h"
+
+ int windowMode = 0;
++int scaleLinear = 0;
++int scaleInteger = 0;
+ int brightness = DEFAULT_BRIGHTNESS;
+-int joystickMode = 1;
+
++static SDL_Window *window;
++static SDL_Renderer *renderer;
++static SDL_Texture *videoTexture;
++static Uint32 textureFormat = SDL_PIXELFORMAT_UNKNOWN;
+ static SDL_Surface *video, *layer, *lpanel, *rpanel;
+ static LayerBit **smokeBuf;
+ static LayerBit *pbuf;
+@@ -47,7 +52,7 @@ static char *spriteFile[SPRITE_NUM] = {
+ "title_s.bmp", "title_a.bmp",
+ };
+
+-Uint8 *keys;
++const Uint8 *keys;
+ SDL_Joystick *stick = NULL;
+
+ static void loadSprites() {
+@@ -55,7 +60,7 @@ static void loadSprites() {
+ int i;
+ char name[56];
+ color[0].r = 100; color[0].g = 0; color[0].b = 0;
+- SDL_SetColors(video, color, 0, 1);
++ SDL_SetPaletteColors(video->format->palette, color, 0, 1);
+ for ( i=0 ; i<SPRITE_NUM ; i++ ) {
+ strcpy(name, SHARE_LOC);
+ strcat(name, "images/");
+@@ -68,11 +73,11 @@ static void loadSprites() {
+ }
+ sprite[i] = SDL_ConvertSurface(img,
+ video->format,
+- SDL_HWSURFACE | SDL_SRCCOLORKEY);
+- SDL_SetColorKey(sprite[i], SDL_SRCCOLORKEY | SDL_RLEACCEL, 0);
++ 0);
++ SDL_SetColorKey(sprite[i], SDL_TRUE, 0);
+ }
+ color[0].r = color[0].g = color[0].b = 255;
+- SDL_SetColors(video, color, 0, 1);
++ SDL_SetPaletteColors(video->format->palette, color, 0, 1);
+ }
+
+ void drawSprite(int n, int x, int y) {
+@@ -89,10 +94,10 @@ static void initPalette() {
+ color[i].g = color[i].g*brightness/256;
+ color[i].b = color[i].b*brightness/256;
+ }
+- SDL_SetColors(video, color, 0, 256);
+- SDL_SetColors(layer, color, 0, 256);
+- SDL_SetColors(lpanel, color, 0, 256);
+- SDL_SetColors(rpanel, color, 0, 256);
++ SDL_SetPaletteColors(video->format->palette, color, 0, 256);
++ SDL_SetPaletteColors(layer->format->palette, color, 0, 256);
++ SDL_SetPaletteColors(lpanel->format->palette, color, 0, 256);
++ SDL_SetPaletteColors(rpanel->format->palette, color, 0, 256);
+ }
+
+ static int lyrSize;
+@@ -124,42 +129,63 @@ static void makeSmokeBuf() {
+ }
+ }
+
+-void initSDL(int window) {
++void initSDL(int windowed, int linear, int integer) {
+ Uint8 videoBpp;
+ Uint32 videoFlags;
+ SDL_PixelFormat *pfrm;
+
+- if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
++ if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0 ) {
+ fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
+ exit(1);
+ }
+ atexit(SDL_Quit);
+- if ( SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0 ) {
+- printf( "Unable to initialize SDL_JOYSTICK: %s\n", SDL_GetError());
+- joystickMode = 0;
+- }
+
+ videoBpp = BPP;
+- videoFlags = SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_HWPALETTE;
+- if ( !window ) videoFlags |= SDL_FULLSCREEN;
++ videoFlags = 0;
++ if ( !windowed ) videoFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+
+- if ( (video = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, videoBpp, videoFlags)) == NULL ) {
+- fprintf(stderr, "Unable to create SDL screen: %s\n", SDL_GetError());
++ if ( (SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, videoFlags, &window, &renderer)) != 0 ) {
++ fprintf(stderr, "Unable to create SDL window: %s\n", SDL_GetError());
+ SDL_Quit();
+ exit(1);
+ }
++ SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT);
++ if (linear) SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
++ if (integer) SDL_RenderSetIntegerScale(renderer, SDL_TRUE);
+ screenRect.x = screenRect.y = 0;
+ screenRect.w = SCREEN_WIDTH; screenRect.h = SCREEN_HEIGHT;
+- pfrm = video->format;
+- if ( NULL == ( layer = SDL_CreateRGBSurface
+- (SDL_SWSURFACE, LAYER_WIDTH, LAYER_HEIGHT, videoBpp,
+- pfrm->Rmask, pfrm->Gmask, pfrm->Bmask, pfrm->Amask)) ||
++ SDL_RendererInfo rendererInfo;
++ SDL_GetRendererInfo(renderer, &rendererInfo);
++ for (Uint32 i = 0; i < rendererInfo.num_texture_formats; ++i) {
++ int fmt = rendererInfo.texture_formats[i];
++ if (SDL_BITSPERPIXEL(fmt) == 32) {
++ textureFormat = fmt;
++ break;
++ }
++ }
++ if (SDL_PIXELFORMAT_UNKNOWN == textureFormat) {
++ fprintf(stderr, "No 32-bit texture format");
++ SDL_Quit();
++ exit(1);
++ }
++ if ( NULL == ( videoTexture = SDL_CreateTexture
++ (renderer, textureFormat, SDL_TEXTUREACCESS_STREAMING,
++ SCREEN_WIDTH, SCREEN_HEIGHT)) ) {
++ fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError());
++ exit(1);
++ }
++ if ( NULL == ( video = SDL_CreateRGBSurface
++ (0, SCREEN_WIDTH, SCREEN_HEIGHT, videoBpp,
++ 0, 0, 0, 0)) ||
++ NULL == ( layer = SDL_CreateRGBSurface
++ (0, LAYER_WIDTH, LAYER_HEIGHT, videoBpp,
++ 0, 0, 0, 0)) ||
+ NULL == ( lpanel = SDL_CreateRGBSurface
+- (SDL_SWSURFACE, PANEL_WIDTH, PANEL_HEIGHT, videoBpp,
+- pfrm->Rmask, pfrm->Gmask, pfrm->Bmask, pfrm->Amask)) ||
++ (0, PANEL_WIDTH, PANEL_HEIGHT, videoBpp,
++ 0, 0, 0, 0)) ||
+ NULL == ( rpanel = SDL_CreateRGBSurface
+- (SDL_SWSURFACE, PANEL_WIDTH, PANEL_HEIGHT, videoBpp,
+- pfrm->Rmask, pfrm->Gmask, pfrm->Bmask, pfrm->Amask)) ) {
++ (0, PANEL_WIDTH, PANEL_HEIGHT, videoBpp,
++ 0, 0, 0, 0)) ) {
+ fprintf(stderr, "Couldn't create surface: %s\n", SDL_GetError());
+ exit(1);
+ }
+@@ -192,11 +218,10 @@ void initSDL(int window) {
+ clearRPanel();
+
+ loadSprites();
+- if (joystickMode == 1) {
+- stick = SDL_JoystickOpen(0);
+- }
+
+- SDL_WM_SetCaption(CAPTION, NULL);
++ stick = SDL_JoystickOpen(0);
++
++ SDL_SetWindowTitle(window, CAPTION);
+ SDL_ShowCursor(SDL_DISABLE);
+ //SDL_WM_GrabInput(SDL_GRAB_ON);
+ }
+@@ -219,7 +244,12 @@ void flipScreen() {
+ if ( status == TITLE ) {
+ drawTitle();
+ }
+- SDL_Flip(video);
++ SDL_Surface *video32 = SDL_ConvertSurfaceFormat(video, textureFormat, 0);
++ SDL_UpdateTexture(videoTexture, NULL, video32->pixels, video32->pitch);
++ SDL_FreeSurface(video32);
++ SDL_RenderClear(renderer);
++ SDL_RenderCopy(renderer, videoTexture, NULL, NULL);
++ SDL_RenderPresent(renderer);
+ }
+
+ void clearScreen() {
+@@ -536,16 +566,16 @@ int getPadState() {
+ x = SDL_JoystickGetAxis(stick, 0);
+ y = SDL_JoystickGetAxis(stick, 1);
+ }
+- if ( keys[SDLK_RIGHT] == SDL_PRESSED || keys[SDLK_KP6] == SDL_PRESSED || x > JOYSTICK_AXIS ) {
++ if ( keys[SDL_SCANCODE_RIGHT] == SDL_PRESSED || keys[SDL_SCANCODE_KP_6] == SDL_PRESSED || x > JOYSTICK_AXIS ) {
+ pad |= PAD_RIGHT;
+ }
+- if ( keys[SDLK_LEFT] == SDL_PRESSED || keys[SDLK_KP4] == SDL_PRESSED || x < -JOYSTICK_AXIS ) {
++ if ( keys[SDL_SCANCODE_LEFT] == SDL_PRESSED || keys[SDL_SCANCODE_KP_4] == SDL_PRESSED || x < -JOYSTICK_AXIS ) {
+ pad |= PAD_LEFT;
+ }
+- if ( keys[SDLK_DOWN] == SDL_PRESSED || keys[SDLK_KP2] == SDL_PRESSED || y > JOYSTICK_AXIS ) {
++ if ( keys[SDL_SCANCODE_DOWN] == SDL_PRESSED || keys[SDL_SCANCODE_KP_2] == SDL_PRESSED || y > JOYSTICK_AXIS ) {
+ pad |= PAD_DOWN;
+ }
+- if ( keys[SDLK_UP] == SDL_PRESSED || keys[SDLK_KP8] == SDL_PRESSED || y < -JOYSTICK_AXIS ) {
++ if ( keys[SDL_SCANCODE_UP] == SDL_PRESSED || keys[SDL_SCANCODE_KP_8] == SDL_PRESSED || y < -JOYSTICK_AXIS ) {
+ pad |= PAD_UP;
+ }
+ return pad;
+@@ -562,14 +592,14 @@ int getButtonState() {
+ btn3 = SDL_JoystickGetButton(stick, 2);
+ btn4 = SDL_JoystickGetButton(stick, 3);
+ }
+- if ( keys[SDLK_z] == SDL_PRESSED || btn1 || btn4 ) {
++ if ( keys[SDL_SCANCODE_Z] == SDL_PRESSED || btn1 || btn4 ) {
+ if ( !buttonReversed ) {
+ btn |= PAD_BUTTON1;
+ } else {
+ btn |= PAD_BUTTON2;
+ }
+ }
+- if ( keys[SDLK_x] == SDL_PRESSED || btn2 || btn3 ) {
++ if ( keys[SDL_SCANCODE_X] == SDL_PRESSED || btn2 || btn3 ) {
+ if ( !buttonReversed ) {
+ btn |= PAD_BUTTON2;
+ } else {
+diff --git a/src/screen.h b/src/screen.h
+index 78a3c3a..b543b7b 100644
+--- a/src/screen.h
++++ b/src/screen.h
+@@ -37,15 +37,17 @@
+ #define DEFAULT_BRIGHTNESS 224
+
+ extern int windowMode;
++extern int scaleLinear;
++extern int scaleInteger;
+ extern LayerBit *l1buf, *l2buf;
+ extern LayerBit *buf;
+ extern LayerBit *lpbuf, *rpbuf;
+-extern Uint8 *keys;
++extern const Uint8 *keys;
+ extern SDL_Joystick *stick;
+ extern int buttonReversed;
+ extern int brightness;
+
+-void initSDL(int window);
++void initSDL(int windowed, int linear, int integer);
+ void closeSDL();
+ void blendScreen();
+ void flipScreen();
diff --git a/debian/patches/series b/debian/patches/series
index 55ab77c..8da8627 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,5 @@
build.patch
reproducible-build.patch
deg-out-of-range.patch
+sdl2.patch
+bulletml.patch
diff --git a/debian/rules b/debian/rules
index 6e5fa3e..9515f0d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,12 +4,14 @@
dh $@
override_dh_auto_build:
- RELEASE_CFLAGS="$(CFLAGS)" dh_auto_build --sourcedirectory=src/bulletml/tinyxml -- 'LD=$$(CXX)'
- CXXFLAGS="$(CXXFLAGS)" dh_auto_build --sourcedirectory=src/bulletml
+ mv src/bulletml src/bulletml.copy
+ #RELEASE_CFLAGS="$(CFLAGS)" dh_auto_build --sourcedirectory=src/bulletml/tinyxml -- 'LD=$$(CXX)'
+ #CXXFLAGS="$(CXXFLAGS)" dh_auto_build --sourcedirectory=src/bulletml
CXXFLAGS="$(CXXFLAGS)" MORE_CFLAGS="$(LDFLAGS)" dh_auto_build --sourcedirectory=src
+ mv src/bulletml.copy src/bulletml
override_dh_auto_clean:
- dh_auto_clean --sourcedirectory=src/bulletml/tinyxml clean
- dh_auto_clean --sourcedirectory=src/bulletml clean
+ #dh_auto_clean --sourcedirectory=src/bulletml/tinyxml clean
+ #dh_auto_clean --sourcedirectory=src/bulletml clean
dh_auto_clean --sourcedirectory=src clean
More information about the Pkg-games-devel
mailing list