From 052ff67446c69fccd633c1b517c66fdfa29a411c Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:22 +0000 Subject: applying patch 01_blockout2-2.4-alt-x86_64.patch diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp index 4ccd8df..06391f8 100644 --- a/BlockOut/Utils.cpp +++ b/BlockOut/Utils.cpp @@ -106,8 +106,9 @@ char *FormatDate(uint32 time) { static char ret[32]; if( time>0 ) { -#ifdef LOCALTIME32 - struct tm *ts = _localtime32((__time32_t *)&time); +#ifdef LOCALTIME64 + time_t d = (time_t)time; + struct tm *ts = localtime(&d); #else time_t innerTm = (time_t)time; struct tm *ts = localtime((time_t *)&innerTm); @@ -130,8 +131,9 @@ char *FormatDateShort(uint32 time) { static char ret[32]; if( time>0 ) { -#ifdef LOCALTIME32 - struct tm *ts = _localtime32((__time32_t *)&time); +#ifdef LOCALTIME64 + time_t d = (time_t)time; + struct tm *ts = localtime(&d); #else time_t innerTm = (time_t)time; struct tm *ts = localtime((time_t *)&innerTm); -- 2.37.3 From fd8dffc6284483b3c318c16867c96e61fc8ace06 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:22 +0000 Subject: applying patch 02_debian-kfreebsd.ftbfs.patch diff --git a/BlockOut/Http.cpp b/BlockOut/Http.cpp index 0b4f12b..b8b5f5f 100644 --- a/BlockOut/Http.cpp +++ b/BlockOut/Http.cpp @@ -224,9 +224,11 @@ int Http::Connect(char *site, int port) { case ENOMEM: sprintf(err_str,"Socket error: Insufficient user memory is available"); break; +#ifdef ENOSR case ENOSR: sprintf(err_str,"Socket error: Insufficient STREAMS resources available"); break; +#endif case EPROTONOSUPPORT: sprintf(err_str,"Socket error: Specified protocol is not supported"); break; -- 2.37.3 From 2c7f50f93e1d0253ba5aa7e9d16c4b5687dccd0a Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:22 +0000 Subject: applying patch 03_debian_multimedia_paths.patch diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp index 06391f8..a220660 100644 --- a/BlockOut/Utils.cpp +++ b/BlockOut/Utils.cpp @@ -209,12 +209,8 @@ BOOL CheckEnv() { return FALSE; } - char *blockoutHome = getenv("BL2_HOME"); - if( blockoutHome==NULL ) { - printf("BL2_HOME environement variable if not defined !\n"); - printf("Please set the BL2_HOME to the BlockOut II installation directory (ex: BL2_HOME=/usr/local/bl2).\n"); - return FALSE; - } + const char *blockoutHome = "/usr/share/games/blockout2"; + strcpy( bl2Home , blockoutHome ); char bl2Dir[512]; -- 2.37.3 From 567454a27b16957334b261402baf0d97aae9c5db Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:22 +0000 Subject: applying patch 04_fixed_all_gcc_warnings.patch diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp index a21a924..8a381ae 100644 --- a/BlockOut/BlockOut.cpp +++ b/BlockOut/BlockOut.cpp @@ -65,11 +65,11 @@ int main(int argc,char *argv[]) // Name: BlockOut() // Desc: Application constructor. Sets attributes for the app. //----------------------------------------------------------------------------- -BlockOut::BlockOut() +BlockOut::BlockOut() : GLApplication(STR(APP_VERSION)) { inited = FALSE; mode = MENU_MODE; - m_strWindowTitle = STR(APP_VERSION); +// m_strWindowTitle = STR(APP_VERSION); ZeroMemory( m_bKey, sizeof(m_bKey) ); } diff --git a/BlockOut/EditControl.cpp b/BlockOut/EditControl.cpp index 5985c09..f2a3b17 100644 --- a/BlockOut/EditControl.cpp +++ b/BlockOut/EditControl.cpp @@ -30,7 +30,7 @@ void EditControl::SetDisplayLength(int length) { // ------------------------------------------------ -void EditControl::SetMode(char *text,BOOL edit,BYTE *keys) { +void EditControl::SetMode(const char *text,BOOL edit,BYTE *keys) { if( strlen(text)>=255 ) { strncpy(editText,text,255); diff --git a/BlockOut/EditControl.h b/BlockOut/EditControl.h index 1028380..12251ed 100644 --- a/BlockOut/EditControl.h +++ b/BlockOut/EditControl.h @@ -27,7 +27,7 @@ class EditControl { void SetDisplayLength(int length); // Set edit control mode (keys can be NULL) - void SetMode(char *text,BOOL edit,BYTE *keys); + void SetMode(const char *text,BOOL edit,BYTE *keys); // Get the mode BOOL GetMode(); diff --git a/BlockOut/GLApp/GLApp.cpp b/BlockOut/GLApp/GLApp.cpp index 3bec6f8..8263b30 100644 --- a/BlockOut/GLApp/GLApp.cpp +++ b/BlockOut/GLApp/GLApp.cpp @@ -14,11 +14,13 @@ extern char *LID(char *fileName); // ------------------------------------------- -GLApplication::GLApplication() { +GLApplication::GLApplication(const char * strWindowTitle) : + m_strWindowTitle(strWindowTitle) +{ m_bWindowed = true; m_bVSync = false; - m_strWindowTitle = (char *)"GL application"; + //m_strWindowTitle = (char *)"GL application"; strcpy((char *)m_strFrameStats,""); m_screenWidth = 640; m_screenHeight = 480; @@ -286,7 +288,7 @@ void GLApplication::printGlError() { #ifdef WINDOWS MessageBox(NULL, message, "Error", MB_OK | MB_ICONERROR); #else - printf(message); + printf("%s", message); #endif } diff --git a/BlockOut/GLApp/GLApp.h b/BlockOut/GLApp/GLApp.h index 105cf0c..66f1486 100644 --- a/BlockOut/GLApp/GLApp.h +++ b/BlockOut/GLApp/GLApp.h @@ -60,7 +60,7 @@ protected: // Internal variables for the state of the app BOOL m_bWindowed; - char* m_strWindowTitle; + const char* m_strWindowTitle; int m_screenWidth; int m_screenHeight; BOOL m_bVSync; @@ -95,7 +95,7 @@ public: static void printGlError(); // Internal constructor - GLApplication(); + GLApplication(const char * strWindowTitle); private: diff --git a/BlockOut/GLApp/GLFont.cpp b/BlockOut/GLApp/GLFont.cpp index 49d079a..4ac88f9 100644 --- a/BlockOut/GLApp/GLFont.cpp +++ b/BlockOut/GLApp/GLFont.cpp @@ -8,7 +8,7 @@ #undef LoadImage #include -extern char *LID(char *fileName); +extern const char *LID(const char *fileName); // ------------------------------------------- @@ -21,7 +21,7 @@ int GLFont2D::RestoreDeviceObjects(int scrWidth,int scrHeight) { // Load the image CImage img; - if( !img.LoadImage(LID((char *)"images/font.png")) ) { + if( !img.LoadImage(LID("images/font.png")) ) { #ifdef WINDOWS char message[256]; sprintf(message,"Failed to load %s\n",LID((char *)"images/font.png")); diff --git a/BlockOut/GLApp/GLSprite.cpp b/BlockOut/GLApp/GLSprite.cpp index 44aee00..27a6aad 100644 --- a/BlockOut/GLApp/GLSprite.cpp +++ b/BlockOut/GLApp/GLSprite.cpp @@ -8,7 +8,7 @@ #undef LoadImage #include -extern char *LID(char *fileName); +extern const char *LID(const char *fileName); // ------------------------------------------- @@ -54,7 +54,7 @@ void Sprite2D::UpdateSprite(int x1,int y1,int x2,int y2) { // ------------------------------------------- -int Sprite2D::RestoreDeviceObjects(char *diffName,char *alphaName,int scrWidth,int scrHeight) { +int Sprite2D::RestoreDeviceObjects(const char *diffName,const char *alphaName,int scrWidth,int scrHeight) { GLint bpp; GLenum format; diff --git a/BlockOut/GLApp/GLSprite.h b/BlockOut/GLApp/GLSprite.h index 3f92868..fca3c1f 100644 --- a/BlockOut/GLApp/GLSprite.h +++ b/BlockOut/GLApp/GLSprite.h @@ -15,7 +15,7 @@ public: // Initialise the sprite // return 1 when success, 0 otherwise - int RestoreDeviceObjects(char *diffName,char *alphaName,int srcWidth,int scrHeight); + int RestoreDeviceObjects(const char *diffName,const char *alphaName,int srcWidth,int scrHeight); // Update sprite mapping and coordinates void UpdateSprite(int x1,int y1,int x2,int y2); diff --git a/BlockOut/Menu.h b/BlockOut/Menu.h index 55e4bfd..dcf5bcc 100644 --- a/BlockOut/Menu.h +++ b/BlockOut/Menu.h @@ -61,8 +61,8 @@ class Menu { // Menu page void ToPage(MenuPage *page); void ToPage(MenuPage *page,int iParam,void *wParam); - void RenderText(int x,int y,BOOL selected,char *text); - void RenderTitle(char *title); + void RenderText(int x,int y,BOOL selected,const char *text); + void RenderTitle(const char *title); PageMainMenu mainMenuPage; PageStartGame startGamePage; diff --git a/BlockOut/MenuGraphics.cpp b/BlockOut/MenuGraphics.cpp index a26e86e..de0be06 100644 --- a/BlockOut/MenuGraphics.cpp +++ b/BlockOut/MenuGraphics.cpp @@ -438,7 +438,7 @@ void Menu::RenderChar(int x,int y,int w,int h,BOOL selected,char c) { // --------------------------------------------------------------------- -void Menu::RenderTitle(char *title) { +void Menu::RenderTitle(const char *title) { int lgth = (int)strlen(title); int nwFont = fround((float)wFont*1.1f); @@ -454,7 +454,7 @@ void Menu::RenderTitle(char *title) { // --------------------------------------------------------------------- -void Menu::RenderText(int x,int y,BOOL selected,char *text) { +void Menu::RenderText(int x,int y,BOOL selected,const char *text) { float startLine = 0.515f; float startColumn = 0.15f; diff --git a/BlockOut/SetupManager.cpp b/BlockOut/SetupManager.cpp index 2d549dc..e142dbe 100644 --- a/BlockOut/SetupManager.cpp +++ b/BlockOut/SetupManager.cpp @@ -364,7 +364,7 @@ int SetupManager::GetTimeout() { // ------------------------------------------------ -char *SetupManager::GetName() { +const char *SetupManager::GetName() { static char ret[32]; strcpy(ret,""); diff --git a/BlockOut/SetupManager.h b/BlockOut/SetupManager.h index 16bf0ca..42d8a6b 100644 --- a/BlockOut/SetupManager.h +++ b/BlockOut/SetupManager.h @@ -67,7 +67,7 @@ class SetupManager { float GetAnimationTime(); /* in seconds */ // Names - char *GetName(); + const char *GetName(); const char *GetBlockSetName(); // Sound diff --git a/BlockOut/SoundManager.cpp b/BlockOut/SoundManager.cpp index bfb2ffd..2996900 100644 --- a/BlockOut/SoundManager.cpp +++ b/BlockOut/SoundManager.cpp @@ -21,6 +21,7 @@ #define PLAY(x) if( enabled && x ) Mix_PlayChannel (-1, x, 0); +extern const char * LID(const char * fileName); // ------------------------------------------------ SoundManager::SoundManager() { @@ -82,7 +83,7 @@ void SoundManager::SetEnable(BOOL enable) { // ------------------------------------------------ -int SoundManager::InitSound(char *fileName,Mix_Chunk **snd) { +int SoundManager::InitSound(const char *fileName,Mix_Chunk **snd) { *snd = Mix_LoadWAV ( fileName ); if( *snd == NULL ) { diff --git a/BlockOut/SoundManager.h b/BlockOut/SoundManager.h index 2195223..a4d2793 100644 --- a/BlockOut/SoundManager.h +++ b/BlockOut/SoundManager.h @@ -55,7 +55,7 @@ class SoundManager { void SetEnable(BOOL enable); private: - int InitSound(char *fileName,Mix_Chunk **snd); + int InitSound(const char *fileName,Mix_Chunk **snd); char errMsg[1024]; BOOL enabled; diff --git a/BlockOut/Types.h b/BlockOut/Types.h index 1bceaef..7c89802 100644 --- a/BlockOut/Types.h +++ b/BlockOut/Types.h @@ -197,21 +197,21 @@ typedef struct { // Util functions //----------------------------------------------------------------------------- -extern VERTEX v(float x,float y,float z); -extern void Normalize(VERTEX *v); -extern int fround(float x); -extern char *FormatTime(float seconds); -extern char *FormatDate(uint32 time); -extern char *FormatDateShort(uint32 time); -extern int CreateTexture(int width,int height,char *imgName,GLuint *hmap); -extern char GetChar(BYTE *keys); +VERTEX v(float x,float y,float z); +void Normalize(VERTEX *v); +int fround(float x); +char *FormatTime(float seconds); +char *FormatDate(uint32 time); +char *FormatDateShort(uint32 time); +int CreateTexture(int width,int height,const char *imgName,GLuint *hmap); +char GetChar(BYTE *keys); #ifndef WINDOWS -extern void ZeroMemory(void *buff,int size); +void ZeroMemory(void *buff,int size); #endif -extern BOOL DirExists(char *dirname); -extern BOOL CheckEnv(); -extern char *LID(char *fileName); -extern char *LHD(char *fileName); +BOOL DirExists(char *dirname); +BOOL CheckEnv(); +const char *LID(const char *fileName); +const char *LHD(const char *fileName); #endif /* TYPESH */ diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp index a220660..1d3020e 100644 --- a/BlockOut/Utils.cpp +++ b/BlockOut/Utils.cpp @@ -236,7 +236,7 @@ BOOL CheckEnv() { // Name: LID() // Desc: Locate file in the installation directory //----------------------------------------------------------------------------- -char *LID(char *fileName) { +const char *LID(const char *fileName) { #ifdef WINDOWS return fileName; @@ -252,7 +252,7 @@ char *LID(char *fileName) { // Name: LHD() // Desc: Locate file in the home directory //----------------------------------------------------------------------------- -char *LHD(char *fileName) { +const char *LHD(const char *fileName) { static char ret[512]; @@ -276,7 +276,7 @@ char *LHD(char *fileName) { // Name: CreateTexture() // Desc: Create a texture (no alpha) //----------------------------------------------------------------------------- -int CreateTexture(int width,int height,char *imgName,GLuint *hmap) { +int CreateTexture(int width,int height,const char *imgName,GLuint *hmap) { *hmap = 0; CImage img; diff --git a/ImageLib/include/CImage.h b/ImageLib/include/CImage.h index cdc350a..882d009 100644 --- a/ImageLib/include/CImage.h +++ b/ImageLib/include/CImage.h @@ -16,7 +16,7 @@ public: // Load an image // Supports GIF , JPG or PNG format // Return 1 when image has been succesfully load , 0 otherwise. - int LoadImage(char *FileName); + int LoadImage(const char *FileName); // Get error message if LoadImage fails. char *GetErrorMessage(); diff --git a/ImageLib/src/CImage.cpp b/ImageLib/src/CImage.cpp index c68eed7..ad14053 100644 --- a/ImageLib/src/CImage.cpp +++ b/ImageLib/src/CImage.cpp @@ -27,7 +27,7 @@ CImage::CImage() { // ------ Load image ----- -int CImage::LoadImage(char *FileName) { +int CImage::LoadImage(const char *FileName) { Release(); diff --git a/ImageLib/src/CImage.h b/ImageLib/src/CImage.h index 2602989..d93bc0d 100644 --- a/ImageLib/src/CImage.h +++ b/ImageLib/src/CImage.h @@ -18,7 +18,7 @@ public: // Load an image // Supports GIF , JPG or PNG format // Return 1 when image has been succesfully load , 0 otherwise. - int LoadImage(char *FileName); + int LoadImage(const char *FileName); // Get error message if LoadImage fails. char *GetErrorMessage(); diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c index 25c7089..e270095 100644 --- a/ImageLib/src/png/hpng.c +++ b/ImageLib/src/png/hpng.c @@ -1,5 +1,6 @@ #include #include +#include #include "png/png.h" #include "hpng.h" -- 2.37.3 From a908bbd2b8ddc75ad221d73b06674d86f918f232 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:23 +0000 Subject: applying patch 05_remove_unnecessary_libdeps.patch diff --git a/ImageLib/src/CImage.cpp b/ImageLib/src/CImage.cpp index ad14053..0746002 100644 --- a/ImageLib/src/CImage.cpp +++ b/ImageLib/src/CImage.cpp @@ -4,10 +4,10 @@ /* Use an ultra fast compression method */ /***************************************************/ #include +#include +#include #include "CImage.h" -#include "gif/gif.h" -#include "jpg/jpegdecoder.h" #include "png/hpng.h" #ifdef WINDOWS @@ -50,55 +50,6 @@ int CImage::LoadImage(const char *FileName) { return 0; } - // Load GIF image - if( strcasecmp(ext,"gif")==0 ) { - - GIF_IMAGE img; - int Length; - - strcpy(img.FileName,FileName); - if( !LoadGifImage(&img) ) { - strcpy(m_LastError,GifErrorMessage); - return 0; - } - - m_Width=img.width; - m_Height=img.height; - Length=m_Width*m_Height; - - m_Data=(BYTE *)malloc( Length*3 ); - - for(int i=0,j=0;i #include #include -#include "png/png.h" +#include #include "hpng.h" char PngErrorMessage[1024]; @@ -100,8 +100,8 @@ int LoadPngImage(PNG_IMAGE *d) { // Convert the image { - unsigned char *src = data; - unsigned char *dst = (unsigned char *)malloc(width*height*3); + char *src = data; + char *dst = (char *)malloc(width*height*3); d->data = dst; for(i = 0 ; i < height ; i++) { for(j = 0 ; j < width ; j++) { @@ -192,5 +192,4 @@ char *WritePngImage(char *file_name,unsigned long width,unsigned long height,uns /* that's it */ return NULL; - } -- 2.37.3 From bdd71f290262ce57492d0d3e07b86b9a303bc94f Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:23 +0000 Subject: applying patch 06_ubuntu_fix_invalid_conversion.patch diff --git a/ImageLib/src/CImage.cpp b/ImageLib/src/CImage.cpp index 0746002..a509ceb 100644 --- a/ImageLib/src/CImage.cpp +++ b/ImageLib/src/CImage.cpp @@ -32,7 +32,7 @@ int CImage::LoadImage(const char *FileName) { Release(); // Get extensions - char *p = strrchr(FileName,'.'); + const char *p = strrchr(FileName,'.'); char ext[12]; if( p==NULL ) { -- 2.37.3 From 7629321cbce86fbe98ebec3b303291653cbd28bb Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:23 +0000 Subject: applying patch 07_ftbfs-with-libpng15.patch diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c index f7817d3..02b6343 100644 --- a/ImageLib/src/png/hpng.c +++ b/ImageLib/src/png/hpng.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "hpng.h" char PngErrorMessage[1024]; @@ -46,8 +46,12 @@ int LoadPngImage(PNG_IMAGE *d) { // ---------------- Error handling png_set_error_fn(png,NULL,my_png_error,NULL); +#if (PNG_LIBPNG_VER < 10500) if (setjmp(png->jmpbuf)) { - png_destroy_read_struct(&png, &info, &endinfo); +#else + if ( setjmp(png_jmpbuf(png)) ) { +#endif + png_destroy_read_struct(&png, &info, &endinfo); return 0; } @@ -155,7 +159,7 @@ char *WritePngImage(char *file_name,unsigned long width,unsigned long height,uns { sprintf(PngErrorMessage,"png_create_info_struct() failed"); fclose(fp); - png_destroy_write_struct(&png_ptr, png_infopp_NULL); + png_destroy_write_struct(&png_ptr, NULL); return PngErrorMessage; } -- 2.37.3 From b361b1918b56bd536dc3042970ec9b2ef0c29255 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:52:23 +0000 Subject: applying patch 08_spelling.patch diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp index 8a381ae..d51837c 100644 --- a/BlockOut/BlockOut.cpp +++ b/BlockOut/BlockOut.cpp @@ -38,7 +38,7 @@ int main(int argc,char *argv[]) #endif { - // Check environement + // Check environment if( !CheckEnv() ) { return 0; } diff --git a/BlockOut/Http.cpp b/BlockOut/Http.cpp index b8b5f5f..332ab96 100644 --- a/BlockOut/Http.cpp +++ b/BlockOut/Http.cpp @@ -233,7 +233,7 @@ int Http::Connect(char *site, int port) { sprintf(err_str,"Socket error: Specified protocol is not supported"); break; default: - sprintf(err_str,"Socket error: Unknow code:%d",errno); + sprintf(err_str,"Socket error: Unknown code:%d",errno); break; } #endif diff --git a/BlockOut/README.txt b/BlockOut/README.txt index b4cd5db..6a4a91a 100644 --- a/BlockOut/README.txt +++ b/BlockOut/README.txt @@ -74,7 +74,7 @@ Version history -Added player/rank name when replaying -New punctuation characters added -Little effect when rotation is blocked - -Fixed "Cannot open blX.bl2replay for writting" + -Fixed "Cannot open blX.bl2replay for writing" -New style (Marble/Arcade) -Fixed crash when pressing [Esc] -Pit animation when the game is over diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp index 1d3020e..a6b2e63 100644 --- a/BlockOut/Utils.cpp +++ b/BlockOut/Utils.cpp @@ -204,7 +204,7 @@ BOOL CheckEnv() { char *homePath = getenv("HOME"); if( homePath==NULL ) { - printf("HOME environement variable if not defined !\n"); + printf("HOME environment variable if not defined !\n"); printf("Please set the HOME variable to your home directory (ex: HOME=/users/jeanluc)\n"); return FALSE; } diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c index 02b6343..23a3077 100644 --- a/ImageLib/src/png/hpng.c +++ b/ImageLib/src/png/hpng.c @@ -139,7 +139,7 @@ char *WritePngImage(char *file_name,unsigned long width,unsigned long height,uns fp = fopen(file_name, "wb"); if (fp == NULL) { - sprintf(PngErrorMessage,"Unable to open the file %s for writting",file_name); + sprintf(PngErrorMessage,"Unable to open the file %s for writing",file_name); return PngErrorMessage; } -- 2.37.3 From 9da60d5cbcccfee230d0b3033977c6eea01f2b45 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 18:55:57 +0000 Subject: update Makefile and optimize build diff --git a/debian/Makefile b/debian/Makefile index 0830ca5..b6d7370 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -9,8 +9,8 @@ TARGET = obj/blockout2 -CFLAGS += -I/usr/include/SDL -I./ImageLib/src -Dlinux $(ADDCFLAGS) -LIBS = -lSDL_mixer -lSDL -lpng -lGLU -lGL +CFLAGS += -O2 -I./ImageLib/src $(ADDCFLAGS) +LIBS = -lSDL_mixer -lSDL -lpng -lGLU -lGL -lnetwork all: obj/obj-dir-stamp $(TARGET) @@ -19,7 +19,7 @@ obj/obj-dir-stamp: touch $@ $(TARGET): $(BOBJ) $(IOBJ) - $(CXX) $^ -o $@ $(LDFLAGS) $(LIBS) + $(CXX) -s $^ -o $@ $(LDFLAGS) $(LIBS) obj/bo/%.o: BlockOut/%.cpp $(CXX) $(CPPFLAGS) -MMD $(CFLAGS) -c $< -o $@ -- 2.37.3 From 69f72fbd47c0b4a26b95b675f383c691a94b53f4 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 19:01:45 +0000 Subject: fix header search paths diff --git a/BlockOut/GLApp/GLApp.h b/BlockOut/GLApp/GLApp.h index 66f1486..d576e36 100644 --- a/BlockOut/GLApp/GLApp.h +++ b/BlockOut/GLApp/GLApp.h @@ -2,8 +2,8 @@ // SDL/OpenGL OpenGL application framework // Jean-Luc PONS (2007) // ------------------------------------------- -#include -#include +#include +#include #include #include diff --git a/BlockOut/GLApp/GLFont.h b/BlockOut/GLApp/GLFont.h index c11debf..90f2644 100644 --- a/BlockOut/GLApp/GLFont.h +++ b/BlockOut/GLApp/GLFont.h @@ -1,7 +1,7 @@ // ----------------------------------------------- // Simple 2D font // ----------------------------------------------- -#include "SDL_opengl.h" +#include "SDL/SDL_opengl.h" #ifndef _GLFONT2DH_ #define _GLFONT2DH_ diff --git a/BlockOut/GLApp/GLMatrix.h b/BlockOut/GLApp/GLMatrix.h index bb5ae60..755bb35 100644 --- a/BlockOut/GLApp/GLMatrix.h +++ b/BlockOut/GLApp/GLMatrix.h @@ -1,7 +1,7 @@ // ------------------------------------- // 3x3 Matrix class // ------------------------------------- -#include +#include #ifndef _GLMATRIXH_ #define _GLMATRIXH_ diff --git a/BlockOut/GLApp/GLSprite.h b/BlockOut/GLApp/GLSprite.h index fca3c1f..32451be 100644 --- a/BlockOut/GLApp/GLSprite.h +++ b/BlockOut/GLApp/GLSprite.h @@ -1,7 +1,7 @@ // ----------------------------------------------- // 2D sprites // ----------------------------------------------- -#include "SDL_opengl.h" +#include "SDL/SDL_opengl.h" #ifndef _SPRITE2DH_ #define _SPRITE2DH_ diff --git a/BlockOut/SoundManager.h b/BlockOut/SoundManager.h index a4d2793..a6d433a 100644 --- a/BlockOut/SoundManager.h +++ b/BlockOut/SoundManager.h @@ -15,7 +15,7 @@ GNU General Public License for more details. */ #include "GLApp/GLApp.h" -#include +#include #ifndef SOUNDMANAGERH #define SOUNDMANAGERH diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c index 23a3077..941fd43 100644 --- a/ImageLib/src/png/hpng.c +++ b/ImageLib/src/png/hpng.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "hpng.h" char PngErrorMessage[1024]; -- 2.37.3 From 038d1a805b7907adb841d816dac6396a4a125914 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 19:03:20 +0000 Subject: keycodes handling diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp index d51837c..af6da1a 100644 --- a/BlockOut/BlockOut.cpp +++ b/BlockOut/BlockOut.cpp @@ -368,12 +368,25 @@ int BlockOut::EventProc(SDL_Event *event) // Handle key presses if( event->type == SDL_KEYDOWN ) { +#ifdef __HAIKU__ + /* handle the incoming key code based on unicode value. + Basic idea taken from sample program checkkeys.c provided + with sdl-1.2.15 source package + */ + if ( event->key.keysym.unicode < ' ' ) { + m_bKey[event->key.keysym.sym] = 1; + } + else { + m_bKey[event->key.keysym.unicode] = 1; + } +#else int unicode = (event->key.keysym.unicode & 0x7F); if( unicode ) { m_bKey[unicode] = 1; } else { m_bKey[event->key.keysym.sym] = 1; } +#endif } return GL_OK; -- 2.37.3 From 688f51a2f85d77cea129aa89fc0aaf3637490811 Mon Sep 17 00:00:00 2001 From: eblanca Date: Sun, 23 Apr 2023 19:06:06 +0000 Subject: locate real executable path diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp index af6da1a..0608fc0 100644 --- a/BlockOut/BlockOut.cpp +++ b/BlockOut/BlockOut.cpp @@ -39,7 +39,11 @@ int main(int argc,char *argv[]) { // Check environment +#ifdef __HAIKU__ + if( !CheckEnv(argv[0]) ) { +#else if( !CheckEnv() ) { +#endif return 0; } diff --git a/BlockOut/Types.h b/BlockOut/Types.h index 7c89802..45ec75a 100644 --- a/BlockOut/Types.h +++ b/BlockOut/Types.h @@ -209,7 +209,11 @@ char GetChar(BYTE *keys); void ZeroMemory(void *buff,int size); #endif BOOL DirExists(char *dirname); +#ifdef __HAIKU__ +BOOL CheckEnv(char *); +#else BOOL CheckEnv(); +#endif const char *LID(const char *fileName); const char *LHD(const char *fileName); diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp index a6b2e63..115a6e1 100644 --- a/BlockOut/Utils.cpp +++ b/BlockOut/Utils.cpp @@ -171,8 +171,11 @@ BOOL DirExists(char *dirname) { // Name: CheckEnv() // Desc: Check environemt //----------------------------------------------------------------------------- +#ifdef __HAIKU__ +BOOL CheckEnv(char *argv0) { +#else BOOL CheckEnv() { - +#endif #ifdef WINDOWS strcpy(usrHome,""); @@ -208,11 +211,23 @@ BOOL CheckEnv() { printf("Please set the HOME variable to your home directory (ex: HOME=/users/jeanluc)\n"); return FALSE; } - +#ifdef __HAIKU__ + char *binpath = realpath(argv0, NULL); + if (binpath != NULL) { + strcpy(bl2Home, binpath); + free(binpath); + char *appdir = strrchr(bl2Home, '/'); + *appdir = '\0'; + } + else { + printf("Fatal: Unable to locate executable directory!\n"); + return FALSE; + } +#else const char *blockoutHome = "/usr/share/games/blockout2"; strcpy( bl2Home , blockoutHome ); - +#endif char bl2Dir[512]; sprintf(bl2Dir,"%s/.bl2",homePath); if( !DirExists(bl2Dir) ) { -- 2.37.3 From b261153f03310e88a9d4be3384882bc3fa7808ed Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Tue, 25 Apr 2023 02:25:38 -0300 Subject: Move settings out of $HOME. Needed to patch Types.h to avoid a "conflicting declaration" error. diff --git a/BlockOut/Types.h b/BlockOut/Types.h index 45ec75a..f3f2d3a 100644 --- a/BlockOut/Types.h +++ b/BlockOut/Types.h @@ -27,6 +27,8 @@ typedef unsigned __int32 uint32; typedef __int32 int32; +#elif __HAIKU__ + #include #else typedef unsigned int uint32; diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp index 115a6e1..1d1c042 100644 --- a/BlockOut/Utils.cpp +++ b/BlockOut/Utils.cpp @@ -15,6 +15,11 @@ GNU General Public License for more details. */ +#ifdef __HAIKU__ +#include +#include +#endif + #include "Types.h" #include #include @@ -229,7 +234,14 @@ BOOL CheckEnv() { strcpy( bl2Home , blockoutHome ); #endif char bl2Dir[512]; +#ifdef __HAIKU__ + dev_t volume = dev_for_path("/boot"); + char settingsDir[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH]; + status_t result = find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, settingsDir, sizeof(settingsDir)); + sprintf(bl2Dir, "%s/blockout2", settingsDir); +#else sprintf(bl2Dir,"%s/.bl2",homePath); +#endif if( !DirExists(bl2Dir) ) { // Create it if( mkdir(bl2Dir,S_IRWXU) < 0 ) { -- 2.37.3